blob: b945f93b1f4a08578a9ab9c79b8c20d9b3258c63 [file] [log] [blame]
Jonathan Hartca335e92015-03-05 10:34:32 -08001/*
2 * Copyright 2015 Open Networking Laboratory
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 */
16
17package org.onosproject.store.ecmap;
18
19import org.onosproject.store.Timestamp;
20import org.onosproject.store.impl.Timestamped;
21
22import java.util.Map;
23
24/**
25 * A persistent store for an eventually consistent map.
26 */
27interface PersistentStore<K, V> {
28
29 /**
30 * Read the contents of the disk into the given maps.
31 *
32 * @param items items map
33 * @param tombstones tombstones map
34 */
35 void readInto(Map<K, Timestamped<V>> items, Map<K, Timestamp> tombstones);
36
37 /**
38 * Puts a new key,value pair into the map on disk.
39 *
40 * @param key the key
41 * @param value the value
42 * @param timestamp the timestamp of the update
43 */
44 void put(K key, V value, Timestamp timestamp);
45
46 /**
47 * Removes a key from the map on disk.
48 *
49 * @param key the key
50 * @param timestamp the timestamp of the update
51 */
52 void remove(K key, Timestamp timestamp);
53}