blob: 8577a84ac6d1533390b7922525403526ac17d10b [file] [log] [blame]
Jordan Halterman00e92da2018-05-22 23:05:52 -07001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.store.primitives.impl;
17
18import org.onosproject.store.service.TransactionalMap;
19
20/**
21 * Atomix transactional map.
22 */
23public class AtomixTransactionalMap<K, V> implements TransactionalMap<K, V> {
24 private final io.atomix.core.transaction.TransactionalMap<K, V> atomixMap;
25
26 public AtomixTransactionalMap(io.atomix.core.transaction.TransactionalMap<K, V> atomixMap) {
27 this.atomixMap = atomixMap;
28 }
29
30 @Override
31 public V get(K key) {
32 return atomixMap.get(key);
33 }
34
35 @Override
36 public boolean containsKey(K key) {
37 return atomixMap.containsKey(key);
38 }
39
40 @Override
41 public V put(K key, V value) {
42 return atomixMap.put(key, value);
43 }
44
45 @Override
46 public V remove(K key) {
47 return atomixMap.remove(key);
48 }
49
50 @Override
51 public V putIfAbsent(K key, V value) {
52 return atomixMap.putIfAbsent(key, value);
53 }
54
55 @Override
56 public boolean remove(K key, V value) {
57 return atomixMap.remove(key, value);
58 }
59
60 @Override
61 public boolean replace(K key, V oldValue, V newValue) {
62 return atomixMap.replace(key, oldValue, newValue);
63 }
64}