flatbacked

package
v0.0.0-...-82353ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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.

type LeasesMap

LeasesMap is used by this storage backend to keep track of leases of children that were confirmed to exist.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL