stores

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWriteLayer

func AddWriteLayer(base cadata.Store, writeTo cadata.Store) cadata.Store

func NewFSStore

func NewFSStore(x posixfs.FS, maxSize int) cadata.Store

func NewMem added in v0.0.3

func NewMem() cadata.Store

Types

type AsyncStore

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

AsyncStore allows blobs to be Posted in the background by a pool of workers. It is not safe for concurrent use by multiple callers.

Close must return nil for any previous Post to be considered successful. When in doubt, call Exists on the underlying store.

If you have a loop that repeatedly calls Post, and Post is high latency, AsyncStore will probably improve performance. AsyncStore is not Read-Your-Writes consistent.

func NewAsyncStore

func NewAsyncStore(target Store, numWorkers int) *AsyncStore

func (*AsyncStore) Close

func (s *AsyncStore) Close() error

func (*AsyncStore) Delete

func (s *AsyncStore) Delete(ctx context.Context, id ID) error

func (*AsyncStore) Exists

func (s *AsyncStore) Exists(ctx context.Context, id ID) (bool, error)

func (*AsyncStore) Get

func (s *AsyncStore) Get(ctx context.Context, id ID, buf []byte) (int, error)

func (*AsyncStore) Hash

func (s *AsyncStore) Hash(x []byte) ID

func (*AsyncStore) List

func (s *AsyncStore) List(ctx context.Context, span cadata.Span, ids []ID) (int, error)

func (*AsyncStore) MaxSize

func (s *AsyncStore) MaxSize() int

func (*AsyncStore) Post

func (s *AsyncStore) Post(ctx context.Context, data []byte) (ID, error)

type ID

type ID = cadata.ID

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 []cadata.ID) (int, error)

type Set

type Set = cadata.Set

type Store

type Store = cadata.Store

func AssertReadOnly

func AssertReadOnly(x Store) Store

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

Jump to

Keyboard shortcuts

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