Package org.onosproject.store.flow.impl
Class FlowBucket
- java.lang.Object
-
- org.onosproject.store.flow.impl.FlowBucket
-
public class FlowBucket extends java.lang.ObjectContainer for a bucket of flows assigned to a specific device.The bucket is mutable. When changes are made to the bucket, the term and timestamp in which the change occurred is recorded for ordering changes.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)Adds the given flow rule to the bucket.BucketIdbucketId()Returns the flow bucket identifier.voidclear()Clears the bucket.intcount()Counts the flows in the bucket.FlowBucketDigestgetDigest()Returns the digest for the bucket.java.util.Map<org.onosproject.net.flow.FlowId,java.util.Map<org.onosproject.net.flow.StoredFlowEntry,org.onosproject.net.flow.StoredFlowEntry>>getFlowBucket()Returns the flow entries in the bucket.java.util.Map<org.onosproject.net.flow.StoredFlowEntry,org.onosproject.net.flow.StoredFlowEntry>getFlowEntries(org.onosproject.net.flow.FlowId flowId)Returns the flow entries for the given flow.voidpurge()Purges the bucket.org.onosproject.net.flow.FlowEntryremove(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)Removes the given flow rule from the bucket.longterm()Returns the flow bucket term.org.onosproject.store.LogicalTimestamptimestamp()Returns the flow bucket timestamp.voidupdate(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)Updates the given flow rule in the bucket.<T> Tupdate(org.onosproject.net.flow.FlowRule rule, java.util.function.Function<org.onosproject.net.flow.StoredFlowEntry,T> function, long term, LogicalClock clock)Applies the given update function to the rule.
-
-
-
Method Detail
-
bucketId
public BucketId bucketId()
Returns the flow bucket identifier.- Returns:
- the flow bucket identifier
-
term
public long term()
Returns the flow bucket term.- Returns:
- the flow bucket term
-
timestamp
public org.onosproject.store.LogicalTimestamp timestamp()
Returns the flow bucket timestamp.- Returns:
- the flow bucket timestamp
-
getDigest
public FlowBucketDigest getDigest()
Returns the digest for the bucket.- Returns:
- the digest for the bucket
-
getFlowBucket
public java.util.Map<org.onosproject.net.flow.FlowId,java.util.Map<org.onosproject.net.flow.StoredFlowEntry,org.onosproject.net.flow.StoredFlowEntry>> getFlowBucket()
Returns the flow entries in the bucket.- Returns:
- the flow entries in the bucket
-
getFlowEntries
public java.util.Map<org.onosproject.net.flow.StoredFlowEntry,org.onosproject.net.flow.StoredFlowEntry> getFlowEntries(org.onosproject.net.flow.FlowId flowId)
Returns the flow entries for the given flow.- Parameters:
flowId- the flow identifier- Returns:
- the flows for the given flow ID
-
count
public int count()
Counts the flows in the bucket.- Returns:
- the number of flows in the bucket
-
add
public void add(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)Adds the given flow rule to the bucket.- Parameters:
rule- the rule to addterm- the term in which the change occurredclock- the logical clock
-
update
public void update(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)Updates the given flow rule in the bucket.- Parameters:
rule- the rule to updateterm- the term in which the change occurredclock- the logical clock
-
update
public <T> T update(org.onosproject.net.flow.FlowRule rule, java.util.function.Function<org.onosproject.net.flow.StoredFlowEntry,T> function, long term, LogicalClock clock)Applies the given update function to the rule.- Type Parameters:
T- the result type- Parameters:
rule- the rule to updatefunction- the update function to applyterm- the term in which the change occurredclock- the logical clock- Returns:
- the update result or
nullif the rule was not updated
-
remove
public org.onosproject.net.flow.FlowEntry remove(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)Removes the given flow rule from the bucket.- Parameters:
rule- the rule to removeterm- the term in which the change occurredclock- the logical clock- Returns:
- the removed flow entry
-
purge
public void purge()
Purges the bucket.
-
clear
public void clear()
Clears the bucket.
-
-