java.lang.Object
org.forgerock.opendj.server.leaderbasedreplication.StreamId
All Implemented Interfaces:
Comparable<StreamId>

public final class StreamId extends Object implements Comparable<StreamId>
Uniquely identifies a replication stream.

A replication stream is a sequence of changes that have been produced by a replica during its lifetime. Each time a replica is started, a new replication stream is created. This is allowing a single replica to apply simultaneously changes coming from client as well as its own previously produced changes coming from other replicas during a recovery from backup.

A StreamId is referencing the ReplicaId which created it as well as the timestamp at which it has been created.

A StreamId can be encoded/decoded to/from a ReplicaId, allowing StreamId to be embedded into the CSNs of changes.

  • Method Details

    • compareTo

      public int compareTo(StreamId o)
      Specified by:
      compareTo in interface Comparable<StreamId>
    • replicaId

      public ReplicaId replicaId()
      Returns the ReplicaId of the replica which created this stream.
      Returns:
      the ReplicaId of the replica which created this stream
    • streamTimeStamp

      public long streamTimeStamp()
      Returns the timestamp at which this stream has been created.
      Returns:
      the timestamp at which this stream has been created
    • of

      public static StreamId of(CSN csn)
      Creates a new StreamId from the provided CSN.
      Parameters:
      csn - the csn
      Returns:
      the new StreamId
    • asCsn

      public CSN asCsn()
      Returns this stream as csn.
      Returns:
      this stream as csn
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toJson

      public JsonValue toJson()
      Returns a JSON representation of this StreamId.
      Returns:
      the JSON representation
    • prettyPrint

      public String prettyPrint()
      Returns a more readable string representation of this StreamId.
      Returns:
      a more readable string representation of this StreamId