blob: 20381bdc2a557049288565c0bd50c72bde884374 [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
Madan Jampanif4c88502016-01-21 12:35:36 -080017package org.onosproject.store.primitives.impl;
Jonathan Hartca335e92015-03-05 10:34:32 -080018
Jonathan Hartca335e92015-03-05 10:34:32 -080019import java.util.Map;
20
21/**
22 * A persistent store for an eventually consistent map.
23 */
24interface PersistentStore<K, V> {
25
26 /**
27 * Read the contents of the disk into the given maps.
28 *
29 * @param items items map
Jonathan Hartca335e92015-03-05 10:34:32 -080030 */
Madan Jampani3d76c942015-06-29 23:37:10 -070031 void readInto(Map<K, MapValue<V>> items);
Jonathan Hartca335e92015-03-05 10:34:32 -080032
33 /**
Madan Jampani3d76c942015-06-29 23:37:10 -070034 * Updates a key,value pair in the persistent store.
Jonathan Hartca335e92015-03-05 10:34:32 -080035 *
36 * @param key the key
37 * @param value the value
Jonathan Hartca335e92015-03-05 10:34:32 -080038 */
Madan Jampani3d76c942015-06-29 23:37:10 -070039 void update(K key, MapValue<V> value);
Madan Jampani4f1f4cd2015-07-08 23:05:35 -070040
41 /**
42 * Removes a key from persistent store.
43 *
44 * @param key the key to remove
45 */
46 void remove(K key);
Jonathan Hartca335e92015-03-05 10:34:32 -080047}