Documentation
¶
Index ¶
- Variables
- func NewBlockDeviceBackedReferenceLeaseRecordArray(device blockdevice.BlockDevice) lossymap.RecordArray[object.LocalReference, Lease, Lease]
- func NewStore(base object.Store[object.FlatReference, struct{}], clock clock.Clock, ...) object.Store[object.LocalReference, Lease]
- type Lease
- type LeasesMap
Constants ¶
This section is empty.
Variables ¶
var LeaseMarshaler leasemarshaling.LeaseMarshaler[Lease] = leaseMarshaler{}
LeaseMarshaler can marshal and unmarshal leases used by the local object store, so that they can be transmitted as part of gRPC requests and responses. This necessary to make sharding work.
var LeaseRecordArrayFactory lossymap.RecordArrayFactory[object.LocalReference, Lease, Lease] = leaseRecordArrayFactory{}
LeaseRecordArrayFactory can be used to create backing stores for the leases map that the flat backed storage backend uses. The leases map can either be stored in memory or on disk.
Functions ¶
func NewBlockDeviceBackedReferenceLeaseRecordArray ¶
func NewBlockDeviceBackedReferenceLeaseRecordArray(device blockdevice.BlockDevice) lossymap.RecordArray[object.LocalReference, Lease, Lease]
NewBlockDeviceBackedReferenceLeaseRecordArray creates a record array for storing leases of that is backed by a block device. By using a block device, leases can be persisted across restarts.
Note that for most setups it's recommended to keep leases in memory.
func NewStore ¶
func NewStore( base object.Store[object.FlatReference, struct{}], clock clock.Clock, leaseCompletenessDuration time.Duration, leasesMap LeasesMap, ) object.Store[object.LocalReference, Lease]
NewStore creates an object store that is implemented on top of a storage backend that is only capable of storing objects in a flat namespace (e.g., a key-value store).
As flat storage backends do not provide facilities for checking that all transitive children of a node are present, this backend compensates for it by handing out timestamp based leases. This causes objects in the flat storage backend to be checked for existence periodically.
Types ¶
type Lease ¶
type Lease uint64
Lease against objects that are stored in a flat storage backend. In the case of this implementation, it is a 64-bit UNIX timestamp at which the existence of the object (and all of its children) was last checked.
A UNIX timestamp is chosen, because it allows leases to be shared between shards.