volumes

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Modify

func Modify(ctx context.Context, vol Volume, fn func(dst stores.RW, x []byte) ([]byte, error)) error

func View

func View(ctx context.Context, vol Volume, fn func(src cadata.Getter, root []byte) error) error

Types

type AEADTx

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

func (*AEADTx) Abort

func (tx *AEADTx) Abort(ctx context.Context) error

func (*AEADTx) Commit

func (tx *AEADTx) Commit(ctx context.Context) error

func (*AEADTx) Exists

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

func (*AEADTx) Get

func (tx *AEADTx) Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)

func (*AEADTx) Hash

func (tx *AEADTx) Hash(data []byte) blobcache.CID

func (*AEADTx) Load

func (tx *AEADTx) Load(ctx context.Context, dst *[]byte) error

func (*AEADTx) MaxSize

func (tx *AEADTx) MaxSize() int

func (*AEADTx) Post

func (tx *AEADTx) Post(ctx context.Context, data []byte) (cid blobcache.CID, err error)

func (*AEADTx) Save

func (tx *AEADTx) Save(ctx context.Context, ptext []byte) error

type AEADVolume

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

func NewChaCha20Poly1305

func NewChaCha20Poly1305(inner Volume, secret *[32]byte) *AEADVolume

NewChaCha20Poly1305 creates a new AEAD volume that uses the ChaCha20Poly1305 algorithm. It uses the 24 byte nonce variant.

func (*AEADVolume) BeginTx

func (v *AEADVolume) BeginTx(ctx context.Context, tp TxParams) (Tx, error)

type Blobcache

type Blobcache struct {
	Service blobcache.Service
	Handle  blobcache.Handle
}

Blobcache is a volume backed by blobcache.

func (*Blobcache) BeginTx

func (bc *Blobcache) BeginTx(ctx context.Context, tp TxParams) (Tx, error)

type GetVerifierFunc

type GetVerifierFunc = func(context.Context, inet256.ID) (sign.PublicKey, error)

type Memory

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

func NewMemory

func NewMemory(hf cadata.HashFunc, maxSize int) *Memory

func (*Memory) BeginTx

func (v *Memory) BeginTx(ctx context.Context, tp blobcache.TxParams) (Tx, error)

type MemoryTx

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

func (*MemoryTx) Abort

func (tx *MemoryTx) Abort(ctx context.Context) error

func (*MemoryTx) Commit

func (tx *MemoryTx) Commit(ctx context.Context) error

func (*MemoryTx) Exists

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

func (*MemoryTx) Get

func (tx *MemoryTx) Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)

func (*MemoryTx) Hash

func (tx *MemoryTx) Hash(data []byte) blobcache.CID

func (*MemoryTx) Load

func (tx *MemoryTx) Load(ctx context.Context, dst *[]byte) error

func (*MemoryTx) MaxSize

func (tx *MemoryTx) MaxSize() int

func (*MemoryTx) Post

func (tx *MemoryTx) Post(ctx context.Context, data []byte) (cid blobcache.CID, err error)

func (*MemoryTx) Save

func (tx *MemoryTx) Save(ctx context.Context, root []byte) error

type SignedTx

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

func (*SignedTx) Abort

func (tx *SignedTx) Abort(ctx context.Context) error

func (*SignedTx) Commit

func (tx *SignedTx) Commit(ctx context.Context) error

func (*SignedTx) Exists

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

func (*SignedTx) Get

func (tx *SignedTx) Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)

func (*SignedTx) Hash

func (tx *SignedTx) Hash(data []byte) blobcache.CID

func (*SignedTx) Load

func (tx *SignedTx) Load(ctx context.Context, dst *[]byte) error

func (*SignedTx) MaxSize

func (tx *SignedTx) MaxSize() int

func (*SignedTx) Post

func (tx *SignedTx) Post(ctx context.Context, data []byte) (blobcache.CID, error)

func (*SignedTx) Save

func (tx *SignedTx) Save(ctx context.Context, src []byte) error

type SignedVolume

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

func NewSignedVolume

func NewSignedVolume(inner Volume, pki inet256.PKI, privateKey inet256.PrivateKey, getVerifier GetVerifierFunc) *SignedVolume

NewSignedVolume creates a SignedVolume. publicKey must not be nil, if privateKey is nil, then the volume will be read only.

func (*SignedVolume) BeginTx

func (v *SignedVolume) BeginTx(ctx context.Context, tp TxParams) (Tx, error)

type Tx

type Tx interface {
	Commit(ctx context.Context) error
	Abort(ctx context.Context) error
	Load(ctx context.Context, dst *[]byte) error
	Save(ctx context.Context, src []byte) error

	Post(ctx context.Context, data []byte) (blobcache.CID, error)
	Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error
	Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)
	MaxSize() int
	Hash(data []byte) blobcache.CID
}

type TxParams

type TxParams = blobcache.TxParams

type Volume

type Volume interface {
	BeginTx(ctx context.Context, tp TxParams) (Tx, error)
}

Jump to

Keyboard shortcuts

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