mem

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mem implements an in-memory blob store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a memory-based implementation of a blob store.

func New

func New() *Store

New produces a new Store.

func (*Store) AnchorMapRef

func (s *Store) AnchorMapRef(_ context.Context) (bs.Ref, error)

AnchorMapRef implements anchor.Getter.

func (*Store) Delete

func (s *Store) Delete(_ context.Context, ref bs.Ref) error

Delete implements bs.DeleterStore.

func (*Store) Get

func (s *Store) Get(_ context.Context, ref bs.Ref) (bs.Blob, error)

Get gets the blob with hash `ref`.

func (*Store) ListRefs

func (s *Store) ListRefs(ctx context.Context, start bs.Ref, f func(bs.Ref) error) error

ListRefs produces all blob refs in the store, in lexicographic order.

func (*Store) Put

func (s *Store) Put(_ context.Context, b bs.Blob) (bs.Ref, bool, error)

Put adds a blob to the store if it wasn't already present.

func (*Store) UpdateAnchorMap

func (s *Store) UpdateAnchorMap(ctx context.Context, f anchor.UpdateFunc) error

UpdateAnchorMap implements anchor.Store. It uses optimistic locking and can return anchor.ErrUpdateConflict.

Jump to

Keyboard shortcuts

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