Fix statistics race condition on big flows
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / registry / CommonDeviceRegistry.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.api.openflow.registry;
10
11 import java.util.function.Consumer;
12
13 public interface CommonDeviceRegistry<KEY> extends AutoCloseable {
14
15     /**
16      * Store KEY in device registry.
17      * @param key device registry key
18      */
19     void store(KEY key);
20
21     /**
22      * Add mark for specified KEY.
23      * @param key device registry key
24      */
25     void addMark(KEY key);
26
27     /**
28      * Checks if registry has mark for KEY.
29      * @param key device registry key
30      * @return true if device registry has mark for KEY
31      */
32     boolean hasMark(KEY key);
33
34     /**
35      * Process marked keys.
36      */
37     void processMarks();
38
39     /**
40      * Iterate over all keys in device registry.
41      * @param consumer key consumer
42      */
43     void forEach(Consumer<KEY> consumer);
44
45     /**
46      * Get device registry size.
47      * @return device registry size
48      */
49     int size();
50
51     @Override
52     void close();
53
54 }