blobs

package
v0.0.0-...-01875d1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("Blob not found")
	ErrInvalid  = errors.New("Blob is not valid")
)

Functions

func Hash

func Hash(data []byte) mh.Multihash

The default hash function

Types

type Blob

type Blob struct {
	ID   ID
	Data []byte
}

func NewBlob

func NewBlob(data []byte) Blob

func (*Blob) String

func (b *Blob) String() string

func (Blob) Valid

func (b Blob) Valid() bool

Valid returns true if the blob is valid.

type Blobsink

type Blobsink interface {
	Put(Blob) error
}

type Blobsource

type Blobsource interface {
	Get(ID) (Blob, error)
}

type Blobstore

type Blobstore interface {
	FiniteBlobsource
	Blobsink
	Delete(ID) error
}

type FiniteBlobsource

type FiniteBlobsource interface {
	ScanKeys(func(ID) bool)
	Scan(func(Blob) bool)
	Blobsource
}

type ID

type ID string

func (*ID) MarshalJSON

func (id *ID) MarshalJSON() ([]byte, error)

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(p []byte) (err error)

type MemStore

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

func NewMemStore

func NewMemStore() *MemStore

func (*MemStore) Delete

func (ms *MemStore) Delete(id ID) error

func (*MemStore) Get

func (ms *MemStore) Get(id ID) (b Blob, err error)

func (*MemStore) Put

func (ms *MemStore) Put(b Blob) error

func (*MemStore) Scan

func (ms *MemStore) Scan(f func(Blob) bool)

func (*MemStore) ScanKeys

func (ms *MemStore) ScanKeys(f func(ID) bool)

type SortedStore

type SortedStore interface {
	Blobstore
	ScanRangeKeys(start, end []byte, f func(ID) bool)
	ScanRange(start, end []byte, f func(Blob) bool)
}

type UnionBlobsource

type UnionBlobsource []Blobsource

func (*UnionBlobsource) Get

func (ubs *UnionBlobsource) Get(id ID) (b Blob, err error)

Jump to

Keyboard shortcuts

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