volumes

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkSet

type LinkSet = map[blobcache.OID]blobcache.ActionSet

type System

type System[Params any, V Volume] interface {
	// Up loads volume state into memory.
	// This should be called to begin using the Volume.
	Up(ctx context.Context, spec Params) (V, error)

	// Drop should remove all state associated with the volume
	Drop(ctx context.Context, vol V) error
}

type Tx

type Tx interface {
	Params() blobcache.TxParams
	Commit(ctx context.Context) error
	Abort(ctx context.Context) error

	Save(ctx context.Context, src []byte) error
	Load(ctx context.Context, dst *[]byte) error

	Post(ctx context.Context, data []byte, opts blobcache.PostOpts) (blobcache.CID, error)
	Get(ctx context.Context, cid blobcache.CID, buf []byte, opts blobcache.GetOpts) (int, error)
	Delete(ctx context.Context, cids []blobcache.CID) error
	Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error
	IsVisited(ctx context.Context, cids []blobcache.CID, dst []bool) error
	Visit(ctx context.Context, cids []blobcache.CID) error

	MaxSize() int
	Hash(salt *blobcache.CID, data []byte) blobcache.CID

	// Link creates adds a handle to prove access to a volume.
	Link(ctx context.Context, target blobcache.OID, rights blobcache.ActionSet, targetVol Volume) error
	// Unlink removes a link from the volume.
	Unlink(ctx context.Context, targets []blobcache.OID) error
	// VisitLinks visits a link to another volume.
	// This is only usable in a GC transaction.
	VisitLinks(ctx context.Context, targets []blobcache.OID) error
}

Tx is a consistent view of a volume, during a transaction.

type UnsaltedStore

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

This is an adapter to a store, since we added salts to the API.

func NewUnsaltedStore

func NewUnsaltedStore(inner Tx) *UnsaltedStore

func ViewUnsalted

func ViewUnsalted(ctx context.Context, tx Tx) (*UnsaltedStore, []byte, error)

func (UnsaltedStore) Delete

func (v UnsaltedStore) Delete(ctx context.Context, cids []blobcache.CID) error

func (UnsaltedStore) Exists

func (v UnsaltedStore) Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error

func (UnsaltedStore) Get

func (v UnsaltedStore) Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)

func (UnsaltedStore) Hash

func (v UnsaltedStore) Hash(data []byte) blobcache.CID

func (UnsaltedStore) MaxSize

func (v UnsaltedStore) MaxSize() int

func (UnsaltedStore) Post

func (v UnsaltedStore) Post(ctx context.Context, data []byte) (blobcache.CID, error)

type Volume

type Volume interface {
	// GetParams returns the effective parameters of the volume.
	GetParams() blobcache.VolumeConfig
	// GetBackend returns the backend of the volume.
	GetBackend() blobcache.VolumeBackend[blobcache.OID]

	BeginTx(ctx context.Context, spec blobcache.TxParams) (Tx, error)

	// AccessSubVolume returns the rights granted to access a subvolume.
	// Returns 0 if there is no link to the target.
	AccessSubVolume(ctx context.Context, target blobcache.OID) (blobcache.ActionSet, error)
}

Directories

Path Synopsis
Package gitvol implements a Volume in terms of Git
Package gitvol implements a Volume in terms of Git

Jump to

Keyboard shortcuts

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