Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
func Extension ¶
func Extension(ct ContentType, ce ContentEncoding) string
Types ¶
type ContentEncoding ¶
type ContentEncoding int
const ( ContentEncodingPlain ContentEncoding = iota ContentEncodingGzip ContentEncodingZlib ContentEncodingFlate )
func ParseContentEncoding ¶
func ParseContentEncoding(compression string) (ContentEncoding, error)
func (ContentEncoding) FileExtension ¶
func (ce ContentEncoding) FileExtension() string
func (ContentEncoding) FilePath ¶
func (ce ContentEncoding) FilePath(key string) string
func (ContentEncoding) String ¶
func (ce ContentEncoding) String() string
type ContentType ¶
type ContentType int
const ( ContentTypeUnknown ContentType = iota ContentTypeText ContentTypeJSON ContentTypeProtobuf )
func ParseContentType ¶
func ParseContentType(contentType string) (ContentType, error)
func (ContentType) FileExtension ¶
func (ct ContentType) FileExtension() string
func (ContentType) FilePath ¶
func (ct ContentType) FilePath(key string) string
func (ContentType) String ¶
func (ct ContentType) String() string
type Headers ¶
type Headers struct {
// ContentType is the type of the object
ContentType ContentType
// ContentEncoding is the compression algorithm used to store the object.
ContentEncoding ContentEncoding
// KeyValue is a map of key-value pairs to store/load with the object.
KeyValue map[string]string
}
Headers are optional metadata about an object to store/load
func (*Headers) GetContentEncoding ¶
func (h *Headers) GetContentEncoding() (ContentEncoding, error)
func (*Headers) GetContentType ¶
type Store ¶
type Store interface {
// Store stores an object in the store.
//
// The key is the identifier for the object.
// The reader is the object to store.
// The headers are optional metadata about the object.
Store(ctx context.Context, key string, reader io.Reader, headers *Headers) error
// Load loads an object from the store.
//
// The key is the identifier for the object.
// The headers are optional metadata about the object.
// It is the responsibility of the caller to close the returned reader
Load(ctx context.Context, key string) (io.ReadCloser, *Headers, error)
// Delete deletes an object from the store.
Delete(ctx context.Context, key string) error
// Copy copies an object from one store to another.
Copy(ctx context.Context, srcKey, dstKey string) error
}
Store is an interface for storing and loading objects.
func WithMetrics ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.