store

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DataTypeStructure describes a blob entry that contains a
	// structure.
	DataTypeStructure = "struct"
)

Variables

View Source
var (
	// ErrShutdown is returned when a action is attempted against a
	// store that is shutdown.
	ErrShutdown = errors.New("store is shutdown")
)

Functions

func Blobify

func Blobify(be BlobEntry) ([]byte, error)

Blobify encodes the provided BlobEntry into a gzipped byte slice.

Types

type BlobEntry

type BlobEntry struct {
	Digest   string `json:"digest"`   // SHA256 digest of data, hex encoded
	DataHint string `json:"datahint"` // Hint that describes data, base64 encoded
	Data     string `json:"data"`     // Data payload, base64 encoded
}

BlobEntry is the structure used to store data in the key-value store.

func Deblob

func Deblob(blob []byte) (*BlobEntry, error)

Deblob decodes the provided gzipped byte slice into a BlobEntry.

func NewBlobEntry

func NewBlobEntry(dataHint, data []byte) BlobEntry

NewBlobEntry returns a new BlobEntry.

type BlobKV

type BlobKV interface {
	// Put saves the provided key-value pairs to the store. This
	// operation is performed atomically.
	Put(blobs map[string][]byte, encrypt bool) error

	// Del deletes the provided blobs from the store. This operation
	// is performed atomically.
	Del(keys []string) error

	// Get returns blobs from the store for the provided keys. An entry
	// will not exist in the returned map if for any blobs that are not
	// found. It is the responsibility of the caller to ensure a blob
	// was returned for all provided keys.
	Get(keys []string) (map[string][]byte, error)

	// Closes closes the store connection.
	Close()
}

BlobKV represents a blob key-value store.

type DataDescriptor

type DataDescriptor struct {
	Type       string `json:"type"`                // Type of data
	Descriptor string `json:"descriptor"`          // Description of the data
	ExtraData  string `json:"extradata,omitempty"` // Value to be freely used
}

DataDescriptor provides hints about a data blob. In practice we JSON encode this struture and stuff it into BlobEntry.DataHint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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