Class MachineSpec.Leased.Builder

java.lang.Object
me.ahoo.cosid.runtime.MachineSpec.Leased.Builder
Enclosing class:
MachineSpec.Leased

public static final class MachineSpec.Leased.Builder extends Object
  • Method Details

    • bits

      public MachineSpec.Leased.Builder bits(int bits)
      Sets the slot bits.
      Parameters:
      bits - the slots are [0, 2^bits); default 10
      Returns:
      this builder
    • ttl

      Sets the lease time to live.
      Parameters:
      ttl - the ttl; default 30s
      Returns:
      this builder
    • tolerance

      public MachineSpec.Leased.Builder tolerance(Duration tolerance)
      Sets how far beyond the expiry the ceiling lies (D20).
      Parameters:
      tolerance - the tolerance; default 1s
      Returns:
      this builder
    • acquireTimeout

      public MachineSpec.Leased.Builder acquireTimeout(Duration acquireTimeout)
      Sets how long CosIdRuntime.start waits for a slot while every slot is held (D42).
      Parameters:
      acquireTimeout - the timeout, not negative; Duration.ZERO tries once; default the ttl
      Returns:
      this builder
    • slotOffset

      public MachineSpec.Leased.Builder slotOffset(int slotOffset)
      Sets the offset added to the slot to give the node of the ids (api-freeze.md §2.1.1); it never changes once used, and every client of the namespace uses the same one.
      Parameters:
      slotOffset - the offset, not negative; default 0
      Returns:
      this builder
    • preferredSlot

      public MachineSpec.Leased.Builder preferredSlot(int preferredSlot)
      Sets the slot to try first, such as a StatefulSet ordinal.
      Parameters:
      preferredSlot - the slot; default none
      Returns:
      this builder
    • ownerKey

      public MachineSpec.Leased.Builder ownerKey(String ownerKey)
      Sets the owner key.
      Parameters:
      ownerKey - the owner key; derived as in 07 §1.1 by default
      Returns:
      this builder
    • namespace

      public MachineSpec.Leased.Builder namespace(String namespace)
      Sets the namespace of the slot leases (D37).
      Parameters:
      namespace - the namespace; default the RuntimeSpec.namespace()
      Returns:
      this builder
    • build

      public MachineSpec.Leased build()
      Builds the leased slot.
      Returns:
      the leased slot