Revert "Revert "Fix statistics race condition on big flows""
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / registry / flow / DeviceFlowRegistry.java
index d410766d6236b084299cacfc7ad319ccfa1c8649..d98f56b3f4cbf1a5b0ab033d31a2818a4ecb1d40 100644 (file)
@@ -9,31 +9,25 @@
 package org.opendaylight.openflowplugin.api.openflow.registry.flow;
 
 
-import java.util.Map;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.List;
+import java.util.function.BiConsumer;
+import org.opendaylight.openflowplugin.api.openflow.registry.CommonDeviceRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 
 /**
- * Created by Martin Bobak <mbobak@cisco.com> on 8.4.2015.
+ * Registry for mapping composite-key of flow ({@link FlowRegistryKey}) from device view
+ * to flow descriptor ({@link FlowDescriptor}) as the identifier of the same flow in data store.
  */
-public interface DeviceFlowRegistry extends AutoCloseable {
+public interface DeviceFlowRegistry extends CommonDeviceRegistry<FlowRegistryKey> {
 
-    void fill(KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifier);
+    ListenableFuture<List<Optional<FlowCapableNode>>> fill();
 
-    FlowDescriptor retrieveIdForFlow(FlowRegistryKey flowRegistryKey);
+    void storeDescriptor(FlowRegistryKey flowRegistryKey, FlowDescriptor flowDescriptor);
 
-    void store(FlowRegistryKey flowRegistryKey, FlowDescriptor flowDescriptor);
+    FlowDescriptor retrieveDescriptor(FlowRegistryKey flowRegistryKey);
 
-    FlowId storeIfNecessary(FlowRegistryKey flowRegistryKey);
+    void forEachEntry(BiConsumer<FlowRegistryKey, FlowDescriptor> consumer);
 
-    void markToBeremoved(FlowRegistryKey flowRegistryKey);
-
-    void removeMarked();
-
-    Map<FlowRegistryKey, FlowDescriptor> getAllFlowDescriptors();
-
-    @Override
-    void close();
 }