stores

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxSize = 1 << 21

Variables

This section is empty.

Functions

func Copy

func Copy(ctx context.Context, src RO, dst WO, cids ...blobcache.CID) error

Copy copies a set of CIDs from src to dst.

func ExistsUnit

func ExistsUnit(ctx context.Context, s Exister, cid blobcache.CID) (bool, error)

func Hash

func Hash(x []byte) blobcache.CID

func NewMem

func NewMem() *schema.MemStore

func NewMemSize added in v0.4.0

func NewMemSize(s int) *schema.MemStore

Types

type CID added in v0.4.0

type CID = blobcache.CID

type CopyFrom

type CopyFrom interface {
	CopyFrom(ctx context.Context, src RO, cids []blobcache.CID, success []bool) error
}

type Exister

type Exister interface {
	Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error
}

type MemSet

type MemSet map[CID]struct{}

func (MemSet) Add

func (ms MemSet) Add(ctx context.Context, id CID) error

func (MemSet) Count

func (ms MemSet) Count() int

func (MemSet) Delete

func (ms MemSet) Delete(ctx context.Context, id CID) error

func (MemSet) Exists

func (ms MemSet) Exists(ctx context.Context, id CID) (bool, error)

type Overlay added in v0.4.0

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

func (Overlay) Exists added in v0.4.0

func (wl Overlay) Exists(ctx context.Context, ids []blobcache.CID, dst []bool) error

func (Overlay) Get added in v0.4.0

func (wl Overlay) Get(ctx context.Context, id blobcache.CID, buf []byte) (int, error)

func (Overlay) MaxSize added in v0.4.0

func (wl Overlay) MaxSize() int

func (Overlay) Post added in v0.4.0

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

type RO added in v0.4.0

type RO interface {
	Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)
	Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error
	MaxSize() int
}

RO is used for read-only operations.

func AssertReadOnly

func AssertReadOnly(x RW) RO

AssertReadOnly returns a new store backup by x, which will panic if it is modified.

type RW

type RW interface {
	RO
	WO
}

Writing is used for read-write operations.

func NewOverlay added in v0.4.0

func NewOverlay(base RO, writeTo RW) RW

type RWD

type RWD interface {
	RO
	WO
	Delete(ctx context.Context, cids []blobcache.CID) error
}

type Set

type Set interface {
	Exists(context.Context, CID) (bool, error)
	Add(context.Context, CID) error
}

type Union added in v0.4.0

type Union []RO

func (Union) Exists added in v0.4.0

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

func (Union) Get added in v0.4.0

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

func (Union) MaxSize added in v0.4.0

func (u Union) MaxSize() int

type Void

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

func NewVoid

func NewVoid() Void

func (Void) Exists

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

func (Void) Hash

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

func (Void) MaxSize

func (v Void) MaxSize() int

func (Void) Post

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

type WO added in v0.4.0

type WO interface {
	Post(ctx context.Context, data []byte) (blobcache.CID, error)
	Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error
	MaxSize() int
}

WO is used for additive copy-on-write operations.

Jump to

Keyboard shortcuts

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