store

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 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 entries to the database. New entries are
	// inserted. Existing entries are updated.
	//
	// This operation is atomic.
	Put(blobs map[string][]byte, encrypt bool) error

	// Del deletes the key-value entries from the database for the provided keys.
	//
	// This operation is atomic.
	Del(keys []string) error

	// Get retrieves the key-value entries from the database for the provided
	// keys.
	//
	// An entry will not exist in the returned map 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)

	// Close closes the database 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