Documentation
¶
Index ¶
- type AllocationStore
- type BlobSizer
- type DsAllocationStore
- func (d *DsAllocationStore) Get(ctx context.Context, digest multihash.Multihash, space did.DID) (allocation.Allocation, error)
- func (d *DsAllocationStore) List(ctx context.Context, digest multihash.Multihash, options ...ListOption) ([]allocation.Allocation, error)
- func (d *DsAllocationStore) Put(ctx context.Context, alloc allocation.Allocation) error
- type ListConfig
- type ListOption
- type MapAllocationStore
- func (m *MapAllocationStore) Get(ctx context.Context, digest multihash.Multihash, space did.DID) (allocation.Allocation, error)
- func (m *MapAllocationStore) List(ctx context.Context, digest multihash.Multihash, options ...ListOption) ([]allocation.Allocation, error)
- func (m *MapAllocationStore) Put(ctx context.Context, alloc allocation.Allocation) error
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.
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 (d *DsAllocationStore) Get(ctx context.Context, digest multihash.Multihash, space did.DID) (allocation.Allocation, error)
func (*DsAllocationStore) List ¶
func (d *DsAllocationStore) List(ctx context.Context, digest multihash.Multihash, options ...ListOption) ([]allocation.Allocation, error)
func (*DsAllocationStore) Put ¶
func (d *DsAllocationStore) Put(ctx context.Context, alloc allocation.Allocation) error
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 (m *MapAllocationStore) Get(ctx context.Context, digest multihash.Multihash, space did.DID) (allocation.Allocation, error)
func (*MapAllocationStore) List ¶ added in v0.0.14
func (m *MapAllocationStore) List(ctx context.Context, digest multihash.Multihash, options ...ListOption) ([]allocation.Allocation, error)
func (*MapAllocationStore) Put ¶ added in v0.0.14
func (m *MapAllocationStore) Put(ctx context.Context, alloc allocation.Allocation) error