Class SlotLease

java.lang.Object
me.ahoo.cosid.lease.SlotLease

public final class SlotLease extends Object
A lease of a time window (floor, ceiling] on a slot (05-machine-lease.md §2). Times are store-clock milliseconds since the Unix epoch. Immutable; built with builder(), the only way to create one, so fields can be added with a default (api-freeze.md §4); toBuilder() derives one.
  • Method Details

    • builder

      public static SlotLease.Builder builder()
      A builder of a lease; the namespace and the owner are required, the numbers default to 0.
      Returns:
      the builder
    • toBuilder

      public SlotLease.Builder toBuilder()
      A builder holding this lease, to derive another.
      Returns:
      the builder
    • namespace

      public String namespace()
      The namespace.
      Returns:
      the namespace
    • slot

      public int slot()
      The slot, in [0, limit).
      Returns:
      the slot
    • owner

      public Owner owner()
      The holder.
      Returns:
      the owner
    • fence

      public long fence()
      Raised on every ownership change (acquire, takeover, release); unchanged by renewals.
      Returns:
      the fence
    • expiresAt

      public long expiresAt()
      When others may take the slot over.
      Returns:
      the expiry
    • floor

      public long floor()
      The holder issues timestamps strictly above it.
      Returns:
      the floor
    • ceiling

      public long ceiling()
      The holder issues timestamps up to it, inclusive.
      Returns:
      the ceiling
    • storeNow

      public long storeNow()
      The store clock of the write that produced this lease.
      Returns:
      the store time
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object