Package me.ahoo.cosid.store.tck
Class InMemoryStore
java.lang.Object
me.ahoo.cosid.store.tck.InMemoryStore
- All Implemented Interfaces:
AutoCloseable,me.ahoo.cosid.lease.SlotLeaseStore,me.ahoo.cosid.segment.RangeStore,me.ahoo.cosid.store.Store
public final class InMemoryStore
extends Object
implements me.ahoo.cosid.store.Store, me.ahoo.cosid.segment.RangeStore, me.ahoo.cosid.lease.SlotLeaseStore
-
Constructor Summary
ConstructorsConstructorDescriptionA store on the system clock.InMemoryStore(me.ahoo.cosid.time.TimeSource storeClock) A store on its own clock, for tests that move the store clock apart from the client clock, such as aManualClock. -
Method Summary
Modifier and TypeMethodDescriptionme.ahoo.cosid.lease.AcquireResultacquire(String namespace, me.ahoo.cosid.lease.Owner owner, int limit, Duration ttl, Duration tolerance, int slotOffset, OptionalInt preferredSlot) voidclose()me.ahoo.cosid.segment.RangeStoreranges()booleanrelease(me.ahoo.cosid.lease.SlotLease lease, long lastIssued) Optional<me.ahoo.cosid.lease.SlotLease> me.ahoo.cosid.segment.RangebooleanSeals the key; a key that does not exist yet is sealed too, so it is never created (S6).me.ahoo.cosid.lease.SlotLeaseStoreslots()me.ahoo.cosid.time.TimeSourceThe clock that stamps every lease of this store.
-
Constructor Details
-
InMemoryStore
public InMemoryStore()A store on the system clock. -
InMemoryStore
public InMemoryStore(me.ahoo.cosid.time.TimeSource storeClock) A store on its own clock, for tests that move the store clock apart from the client clock, such as aManualClock.- Parameters:
storeClock- the store clock
-
-
Method Details
-
storeClock
public me.ahoo.cosid.time.TimeSource storeClock()The clock that stamps every lease of this store.- Returns:
- the store clock
-
ranges
public me.ahoo.cosid.segment.RangeStore ranges()- Specified by:
rangesin interfaceme.ahoo.cosid.store.Store
-
slots
public me.ahoo.cosid.lease.SlotLeaseStore slots()- Specified by:
slotsin interfaceme.ahoo.cosid.store.Store
-
reserve
- Specified by:
reservein interfaceme.ahoo.cosid.segment.RangeStore
-
seal
Seals the key; a key that does not exist yet is sealed too, so it is never created (S6).- Specified by:
sealin interfaceme.ahoo.cosid.segment.RangeStore- Parameters:
key- the range key- Returns:
- true
-
acquire
public me.ahoo.cosid.lease.AcquireResult acquire(String namespace, me.ahoo.cosid.lease.Owner owner, int limit, Duration ttl, Duration tolerance, int slotOffset, OptionalInt preferredSlot) - Specified by:
acquirein interfaceme.ahoo.cosid.lease.SlotLeaseStore
-
renew
public Optional<me.ahoo.cosid.lease.SlotLease> renew(me.ahoo.cosid.lease.SlotLease lease, Duration ttl, Duration tolerance) - Specified by:
renewin interfaceme.ahoo.cosid.lease.SlotLeaseStore
-
release
public boolean release(me.ahoo.cosid.lease.SlotLease lease, long lastIssued) - Specified by:
releasein interfaceme.ahoo.cosid.lease.SlotLeaseStore
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceme.ahoo.cosid.segment.RangeStore- Specified by:
closein interfaceme.ahoo.cosid.lease.SlotLeaseStore- Specified by:
closein interfaceme.ahoo.cosid.store.Store
-