Class FlowBucket


  • public class FlowBucket
    extends java.lang.Object
    Container 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
      void add​(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)
      Adds the given flow rule to the bucket.
      BucketId bucketId()
      Returns the flow bucket identifier.
      void clear()
      Clears the bucket.
      int count()
      Counts the flows in the bucket.
      FlowBucketDigest getDigest()
      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.
      void purge()
      Purges the bucket.
      org.onosproject.net.flow.FlowEntry remove​(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)
      Removes the given flow rule from the bucket.
      long term()
      Returns the flow bucket term.
      org.onosproject.store.LogicalTimestamp timestamp()
      Returns the flow bucket timestamp.
      void update​(org.onosproject.net.flow.FlowEntry rule, long term, LogicalClock clock)
      Updates the given flow rule in the bucket.
      <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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 add
        term - the term in which the change occurred
        clock - 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 update
        term - the term in which the change occurred
        clock - 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 update
        function - the update function to apply
        term - the term in which the change occurred
        clock - the logical clock
        Returns:
        the update result or null if 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 remove
        term - the term in which the change occurred
        clock - the logical clock
        Returns:
        the removed flow entry
      • purge

        public void purge()
        Purges the bucket.
      • clear

        public void clear()
        Clears the bucket.