volumes

package
v0.0.0-...-575026b Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type System

type System[K any] interface {
	Create(ctx context.Context, k K, spec blobcache.VolumeSpec) error
	Open(ctx context.Context, k K) (Volume, error)
	Drop(ctx context.Context, k K) error
	Clone(ctx context.Context, k K) (Volume, error)
}

type Tx

type Tx interface {
	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

	// AllowLink creates adds a handle to prove access to a volume.
	AllowLink(ctx context.Context, subvol blobcache.Handle) 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 Vault

type Vault struct {
	Inner Volume
	// contains filtered or unexported fields
}

func NewVault

func NewVault(inner Volume, secret [32]byte) *Vault

func (*Vault) Await

func (v *Vault) Await(ctx context.Context, prev []byte, next *[]byte) error

func (*Vault) BeginTx

func (v *Vault) BeginTx(ctx context.Context, params blobcache.TxParams) (Tx, error)

type VaultTx

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

func (*VaultTx) Abort

func (v *VaultTx) Abort(ctx context.Context) error
func (v *VaultTx) AllowLink(ctx context.Context, subvol blobcache.Handle) error

func (*VaultTx) Commit

func (v *VaultTx) Commit(ctx context.Context) error

func (*VaultTx) Delete

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

func (*VaultTx) Exists

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

func (*VaultTx) Get

func (v *VaultTx) Get(ctx context.Context, cid blobcache.CID, buf []byte, opts blobcache.GetOpts) (int, error)

func (*VaultTx) Hash

func (v *VaultTx) Hash(salt *blobcache.CID, data []byte) blobcache.CID

func (*VaultTx) IsVisited

func (v *VaultTx) IsVisited(ctx context.Context, cids []blobcache.CID, dst []bool) error

func (*VaultTx) Load

func (v *VaultTx) Load(ctx context.Context, dst *[]byte) error

func (*VaultTx) MaxSize

func (v *VaultTx) MaxSize() int

func (*VaultTx) Post

func (v *VaultTx) Post(ctx context.Context, data []byte, opts blobcache.PostOpts) (blobcache.CID, error)

func (*VaultTx) Save

func (v *VaultTx) Save(ctx context.Context, src []byte) error

func (*VaultTx) Visit

func (v *VaultTx) Visit(ctx context.Context, cids []blobcache.CID) error

func (*VaultTx) Volume

func (tx *VaultTx) Volume() Volume

type Volume

type Volume interface {
	BeginTx(ctx context.Context, spec blobcache.TxParams) (Tx, error)
	// Await blocks until the volume root changes away from prev to something else.
	// The next state is written to next.
	Await(ctx context.Context, prev []byte, next *[]byte) 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