Documentation
¶
Overview ¶
Package blob defines the object store that holds PDFs and artifacts, and a registry of drivers selected by URL scheme. Drivers register themselves from init, as database/sql drivers do; import them for their side effect (for example blob/disk).
Stability ¶
This package is for driver authors and the Inkless service itself. It may change incompatibly until v1.
Contract ¶
A Store is safe for concurrent use. Objects are addressed by content: the key of an object is Key of the hex SHA-256 of its bytes, and drivers accept only keys of that form. Objects are written once and never replaced. Drivers do not check the digest; the caller verifies every Get against its key and fails closed on a mismatch.
Index ¶
Constants ¶
const DefaultURL = "file:blobs"
DefaultURL is used when no blob URL is configured: a directory named blobs in the working directory.
const MaxSize = 64 << 20
MaxSize is the largest object Get returns.
Variables ¶
var ( // ErrNotFound is returned by Get when the key does not exist. ErrNotFound = errors.New("blob: not found") // ErrTooLarge is returned by Get when an object exceeds MaxSize. ErrTooLarge = errors.New("blob: object too large") // ErrInvalidKey is returned for keys that are not content addresses. ErrInvalidKey = errors.New("blob: invalid key") )
Functions ¶
func ReadAll ¶
ReadAll reads r to the end and returns ErrTooLarge if it holds more than MaxSize bytes.
Types ¶
type Store ¶
type Store interface {
// Put stores data under key. Putting an existing key succeeds without
// changing it.
Put(ctx context.Context, key string, data []byte) error
// Get returns the object stored under key, or ErrNotFound.
Get(ctx context.Context, key string) ([]byte, error)
}
Store holds immutable objects by content address.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package blobtest is the conformance suite every blob driver must pass.
|
Package blobtest is the conformance suite every blob driver must pass. |
|
Package disk registers the default blob driver for URLs of the form file:PATH (file:blobs, file:/var/lib/inkless/blobs).
|
Package disk registers the default blob driver for URLs of the form file:PATH (file:blobs, file:/var/lib/inkless/blobs). |
|
Package s3 registers a blob driver for S3-compatible stores, selected by URLs of the form
|
Package s3 registers a blob driver for S3-compatible stores, selected by URLs of the form |