Class LWWRegister<A>

    • Constructor Detail

      • LWWRegister

        public LWWRegister​(UniqueAddress node,
                           A value,
                           long timestamp)
    • Method Detail

      • defaultClock

        public static <A> LWWRegister.Clock<A> defaultClock()
        The default LWWRegister.Clock is using max value of System.currentTimeMillis() and currentTimestamp + 1.
        Returns:
        (undocumented)
      • reverseClock

        public static <A> LWWRegister.Clock<A> reverseClock()
        This LWWRegister.Clock can be used for first-write-wins semantics. It is using min value of -System.currentTimeMillis() and currentTimestamp + 1, i.e. it is counting backwards.
        Returns:
        (undocumented)
      • apply

        public static <A> LWWRegister<A> apply​(UniqueAddress node,
                                               A initialValue,
                                               LWWRegister.Clock<A> clock)
        INTERNAL API
        Parameters:
        node - (undocumented)
        initialValue - (undocumented)
        clock - (undocumented)
        Returns:
        (undocumented)
      • apply

        public static <A> LWWRegister<A> apply​(A initialValue,
                                               Cluster node,
                                               LWWRegister.Clock<A> clock)
        Deprecated.
        Use `apply` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
      • apply$default$3

        public static <A> LWWRegister.Clock<A> apply$default$3​(A initialValue)
      • create

        public static <A> LWWRegister<A> create​(A initialValue,
                                                SelfUniqueAddress node,
                                                LWWRegister.Clock<A> clock)
        Scala API Creates a LWWRegister with implicits, given deprecated apply functions using Cluster constrain overloading.
        Parameters:
        initialValue - (undocumented)
        node - (undocumented)
        clock - (undocumented)
        Returns:
        (undocumented)
      • create

        public static <A> LWWRegister<A> create​(Cluster node,
                                                A initialValue)
        Deprecated.
        Use `create` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
        Java API
        Parameters:
        node - (undocumented)
        initialValue - (undocumented)
        Returns:
        (undocumented)
      • create

        public static <A> LWWRegister<A> create​(Cluster node,
                                                A initialValue,
                                                LWWRegister.Clock<A> clock)
        Deprecated.
        Use `create` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
        Java API
        Parameters:
        node - (undocumented)
        initialValue - (undocumented)
        clock - (undocumented)
        Returns:
        (undocumented)
      • create

        public static <A> LWWRegister<A> create​(SelfUniqueAddress node,
                                                A initialValue,
                                                LWWRegister.Clock<A> clock)
        Java API
        Parameters:
        node - (undocumented)
        initialValue - (undocumented)
        clock - (undocumented)
        Returns:
        (undocumented)
      • create

        public static <A> LWWRegister<A> create​(SelfUniqueAddress node,
                                                A initialValue)
        Java API
        Parameters:
        node - (undocumented)
        initialValue - (undocumented)
        Returns:
        (undocumented)
      • create$default$3

        public static <A> LWWRegister.Clock<A> create$default$3​(A initialValue)
      • unapply

        public static <A> scala.Option<A> unapply​(LWWRegister<A> c)
        Extract the value().
        Parameters:
        c - (undocumented)
        Returns:
        (undocumented)
      • value

        public A value()
      • timestamp

        public long timestamp()
      • getValue

        public A getValue()
        Java API
        Returns:
        (undocumented)
      • withValue

        public LWWRegister<A> withValue​(SelfUniqueAddress node,
                                        A value,
                                        LWWRegister.Clock<A> clock)
        Change the value of the register.

        You can provide your clock implementation instead of using timestamps based on System.currentTimeMillis() time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.

        Parameters:
        node - (undocumented)
        value - (undocumented)
        clock - (undocumented)
        Returns:
        (undocumented)
      • withValue

        public LWWRegister<A> withValue​(SelfUniqueAddress node,
                                        A value)
        Change the value of the register.
        Parameters:
        node - (undocumented)
        value - (undocumented)
        Returns:
        (undocumented)
      • withValueOf

        public LWWRegister<A> withValueOf​(A value,
                                          SelfUniqueAddress node,
                                          LWWRegister.Clock<A> clock)
        Change the value of the register.

        You can provide your clock implementation instead of using timestamps based on System.currentTimeMillis() time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.

        Parameters:
        value - (undocumented)
        node - (undocumented)
        clock - (undocumented)
        Returns:
        (undocumented)
      • withValue

        public LWWRegister<A> withValue​(A value,
                                        Cluster node,
                                        LWWRegister.Clock<A> clock)
        Deprecated.
        Use `withValueOf` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
      • withValue

        public LWWRegister<A> withValue​(Cluster node,
                                        A value)
        Deprecated.
        Use `withValue` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
      • withValue

        public LWWRegister<A> withValue​(Cluster node,
                                        A value,
                                        LWWRegister.Clock<A> clock)
        Deprecated.
        Use `withValue` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
      • updatedBy

        public UniqueAddress updatedBy()
        The current value was set by this node.
        Returns:
        (undocumented)
      • withValue

        public LWWRegister<A> withValue​(UniqueAddress node,
                                        A value,
                                        LWWRegister.Clock<A> clock)
        INTERNAL API
        Parameters:
        node - (undocumented)
        value - (undocumented)
        clock - (undocumented)
        Returns:
        (undocumented)
      • merge

        public LWWRegister<A> merge​(LWWRegister<A> that)
        INTERNAL API
        Parameters:
        that - (undocumented)
        Returns:
        (undocumented)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object