java.lang.Object
me.ahoo.cosid.runtime.MachineSpec.Leased
- All Implemented Interfaces:
MachineSpec
- Enclosing interface:
MachineSpec
A slot leased from a store.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface me.ahoo.cosid.runtime.MachineSpec
MachineSpec.Leased, MachineSpec.Static -
Method Summary
Modifier and TypeMethodDescriptionHow longCosIdRuntime.startwaits for a slot while every slot is held (D42): it retries as leases expire, then fails;Duration.ZEROtries once.intbits()The slot bits: the slots are[0, 2^bits).static MachineSpec.Leased.BuilderA builder of a leased slot.booleaninthashCode()The namespace of the slot leases (D37): a machine shared by several services, such as the slot of a cosid80 generator unique across them, names its own; every machine of a runtime has another namespace.ownerKey()The owner key.The slot to try first, such as a StatefulSet ordinal.intAdded to the slot to give the node of the ids (api-freeze.md §2.1.1): the nodes of this machine are[slotOffset, slotOffset + 2^bits), apart from the 4.x machine ids below it during a rolling migration.store()The store name.How far beyond the expiry the ceiling lies (D20).toString()ttl()The lease time to live.withNamespace(String namespace) This machine in another namespace.
-
Method Details
-
builder
A builder of a leased slot.- Parameters:
store- the store name- Returns:
- the builder
-
store
The store name.- Returns:
- the store name
-
bits
public int bits()The slot bits: the slots are[0, 2^bits).- Specified by:
bitsin interfaceMachineSpec- Returns:
- the slot bits; default 10
-
ttl
The lease time to live.- Returns:
- the ttl; default 30s
-
tolerance
How far beyond the expiry the ceiling lies (D20).- Returns:
- the tolerance; default 1s
-
acquireTimeout
How longCosIdRuntime.startwaits for a slot while every slot is held (D42): it retries as leases expire, then fails;Duration.ZEROtries once. Align it with the startup probe of a rolling update.- Returns:
- the acquire timeout, not negative; default the
ttl()
-
slotOffset
public int slotOffset()Added to the slot to give the node of the ids (api-freeze.md §2.1.1): the nodes of this machine are[slotOffset, slotOffset + 2^bits), apart from the 4.x machine ids below it during a rolling migration. The store keeps the slots[0, 2^bits)and records the offset; every client of the namespace must use the same one, and once used it never changes.- Returns:
- the slot offset, not negative; default 0
-
preferredSlot
The slot to try first, such as a StatefulSet ordinal.- Returns:
- the preferred slot; default none
-
ownerKey
The owner key.- Returns:
- the owner key; derived as in 07 §1.1 when empty (the default)
-
namespace
Description copied from interface:MachineSpecThe namespace of the slot leases (D37): a machine shared by several services, such as the slot of a cosid80 generator unique across them, names its own; every machine of a runtime has another namespace.- Specified by:
namespacein interfaceMachineSpec- Returns:
- the namespace; empty for the
RuntimeSpec.namespace()
-
withNamespace
This machine in another namespace.- Parameters:
namespace- the namespace of the slot leases- Returns:
- the machine
-
equals
-
hashCode
public int hashCode() -
toString
-