Class MapValue<V>

  • Type Parameters:
    V - value type
    All Implemented Interfaces:
    Comparable<MapValue<V>>

    public class MapValue<V>
    extends Object
    implements Comparable<MapValue<V>>
    Representation of a value in EventuallyConsistentMap.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MapValue.Digest
      Digest or summary of a MapValue for use during Anti-Entropy exchanges.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapValue​(V value, org.onosproject.store.Timestamp timestamp)
      Constructor automatically to create the system time of construction.
      MapValue​(V value, org.onosproject.store.Timestamp timestamp, long creationTime)
      Creates a map value using value, timestamp, and creation time.
    • Constructor Detail

      • MapValue

        public MapValue​(V value,
                        org.onosproject.store.Timestamp timestamp)
        Constructor automatically to create the system time of construction.
        Parameters:
        value - value
        timestamp - value timestamp
      • MapValue

        public MapValue​(V value,
                        org.onosproject.store.Timestamp timestamp,
                        long creationTime)
        Creates a map value using value, timestamp, and creation time.
        Parameters:
        value - value
        timestamp - value timestamp.
        creationTime - the system time (on local instance) of construction
    • Method Detail

      • tombstone

        public static <U> MapValue<U> tombstone​(org.onosproject.store.Timestamp timestamp)
        Creates a tombstone value with the specified timestamp.
        Type Parameters:
        U - value type
        Parameters:
        timestamp - timestamp for tombstone
        Returns:
        tombstone MapValue
      • copy

        public MapValue<V> copy()
        Creates a copy of MapValue.

        The copy will have an updated creation time corresponding to when the copy was constructed.

        Returns:
        MapValue copy
      • isTombstone

        public boolean isTombstone()
        Tests if this value is tombstone value with the specified timestamp.
        Returns:
        true if this value is null, otherwise false
      • isAlive

        public boolean isAlive()
        Tests if this value is alive.
        Returns:
        true if this value is not null, otherwise false
      • timestamp

        public org.onosproject.store.Timestamp timestamp()
        Returns the timestamp of this value.
        Returns:
        timestamp
      • get

        public V get()
        Returns this value.
        Returns:
        value
      • creationTime

        public long creationTime()
        Returns the creation time of this value.
        Returns:
        creationTime
      • isNewerThan

        public boolean isNewerThan​(MapValue<V> other)
        Tests if this value is newer than the specified MapValue.
        Parameters:
        other - the value to be compared
        Returns:
        true if this value is newer than other
      • isNewerThan

        public boolean isNewerThan​(org.onosproject.store.Timestamp timestamp)
        Tests if this timestamp is newer than the specified timestamp.
        Parameters:
        timestamp - timestamp to be compared
        Returns:
        true if this instance is newer
      • digest

        public MapValue.Digest digest()
        Returns summary of a MapValue for use during Anti-Entropy exchanges.
        Returns:
        Digest with timestamp and whether this value is null or not
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object