blob

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GzipCompression indicates blob was compressed using compress/gzip package
	GzipCompression = "compress/gzip"
)

the following constants are all compressions that have ever been used, names should describe the package used

View Source
const (
	// JSONEncoding indicates blob was encoded as JSON
	JSONEncoding = "json"
)

the following constants are all encoding formats that have ever been used

Variables

This section is empty.

Functions

func Unwrap

func Unwrap(blob *Blob) (*Blob, *WrappingLayers, error)

Unwrap returns a deep copy of input blob with all layers unwrapped. Input blob is not modified. Returned WrappingLayers indicate the layers that were unwrapped and the values of such each layer.

Types

type Blob

type Blob struct {
	Body []byte
	Tags map[string]string
}

Blob is the entity that gets handled by blobstore

func DeepCopy

func DeepCopy(blob *Blob) *Blob

DeepCopy returns a deep copy of input blob

func NewBlob

func NewBlob(body []byte, tags map[string]string) *Blob

NewBlob constructs a new blob with body and tags

func Wrap

func Wrap(blob *Blob, functions ...WrapFn) (*Blob, error)

Wrap returns a deep copy of input blob with all wrapping functions applied. Input blob is not modified.

type Key

type Key interface {
	String() string
	Pieces() []string
	Extension() string
}

Key identifies a blob

func NewKey

func NewKey(extension string, pieces ...string) (Key, error)

NewKey constructs a new valid key or returns error on any input that produces an invalid key A valid key is of form foo_bar_baz_raz.ext The section before the period is considered the key name and the piece after the period is considered the extension Pieces are combined to form the key name and pieces are separated by underscores Keys are immutable

func NewKeyFromString

func NewKeyFromString(str string) (Key, error)

NewKeyFromString constructs a valid key from string or returns error if input produces invalid key

type WrapFn

type WrapFn func(*Blob) error

WrapFn adds a single layer to a blob's wrapping; will update wrapper metadata tag and potentially modify body. WrapFn can leave input blob in an invalid state, but will always return an error in such cases.

func GzipCompressed

func GzipCompressed() WrapFn

GzipCompressed returns a WrapFn used to compresses body using gzip and indicates that at the compression layer gzip was used

func JSONEncoded

func JSONEncoded() WrapFn

JSONEncoded returns a WrapFn used to indicate that at the encoding layer json was used

type WrappingLayers

type WrappingLayers struct {
	EncodingFormat *string
	Compression    *string
}

WrappingLayers indicates the values of every wrapping layer of a blob, nil fields indicate that blob was not wrapped with layer.

Jump to

Keyboard shortcuts

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