stores

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: 6 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 Reading, dst Writing, 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

Types

type CopyFrom

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

type Exister

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

type ID

type ID = blobcache.CID

type MemSet

type MemSet map[ID]struct{}

func (MemSet) Add

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

func (MemSet) Count

func (ms MemSet) Count() int

func (MemSet) Delete

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

func (MemSet) Exists

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

func (MemSet) List

func (ms MemSet) List(ctx context.Context, span cadata.Span, ids []blobcache.CID) (int, error)

type RW

type RW interface {
	Reading
	Writing
}

Writing is used for read-write operations.

func AddWriteLayer

func AddWriteLayer(base Reading, writeTo RW) RW

type RWD

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

type Reading

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

Reading is used for read-only operations.

func AssertReadOnly

func AssertReadOnly(x RW) Reading

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

type Set

type Set = cadata.Set

type Store

type Store = cadata.Store

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 Writing

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

Writing 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