allocationstore

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocationStore

type AllocationStore interface {
	// Get retrieves an allocation for a blob (digest) in a space (DID). It
	// returns [github.com/storacha/piri/pkg/store.ErrNotFound] if the allocation
	// does not exist.
	Get(context.Context, multihash.Multihash, did.DID) (allocation.Allocation, error)
	// List retrieves allocations by the digest of the data allocated. Note: may
	// return an empty slice.
	List(context.Context, multihash.Multihash, ...ListOption) ([]allocation.Allocation, error)
	// Put adds or replaces allocation data in the store.
	Put(context.Context, allocation.Allocation) error
}

AllocationStore tracks the items that have been, or will soon be stored on the storage node.

type BlobSizer added in v0.0.14

type BlobSizer struct {
	// contains filtered or unexported fields
}

BlobSizer is a utility to obtain the size of a blob using data from the allocation table.

func NewBlobSizer added in v0.0.14

func NewBlobSizer(store AllocationStore) *BlobSizer

NewBlobSizer creates a new utility to obtain the size of a blob using data from the allocation table.

func (*BlobSizer) Size added in v0.0.14

func (bs *BlobSizer) Size(ctx context.Context, digest multihash.Multihash) (uint64, error)

Size returns the size of the blob, provided it has been allocated. Returns store.ErrNotFound if there are no allocations in the store the for blob.

type DsAllocationStore

type DsAllocationStore struct {
	// contains filtered or unexported fields
}

func NewDsAllocationStore

func NewDsAllocationStore(ds datastore.Datastore) (*DsAllocationStore, error)

NewDsAllocationStore creates an AllocationStore backed by an IPFS datastore.

func (*DsAllocationStore) Get added in v0.0.14

func (*DsAllocationStore) List

func (*DsAllocationStore) Put

type ListConfig added in v0.0.14

type ListConfig struct {
	Limit int
}

type ListOption added in v0.0.14

type ListOption func(c *ListConfig)

ListOption is an option for configuring a call to List.

func WithLimit added in v0.0.14

func WithLimit(max int) ListOption

WithLimit configures the maximum number of items that will be returned.

type MapAllocationStore added in v0.0.14

type MapAllocationStore struct {
	// contains filtered or unexported fields
}

MapAllocationStore is a store for allocations, backed by an in-memory map.

func NewMapAllocationStore added in v0.0.14

func NewMapAllocationStore() *MapAllocationStore

NewMapAllocationStore creates a for allocations, backed by an in-memory map.

func (*MapAllocationStore) Get added in v0.0.14

func (*MapAllocationStore) List added in v0.0.14

func (*MapAllocationStore) Put added in v0.0.14

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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