Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDataInconsistent = errors.New("data consistency check failed")
ErrDataInconsistent is returned when the data being written does not hash to the expected value.
View Source
var ErrTooLarge = errors.New("payload too large")
ErrTooLarge is returned when the data being written is larger than expected.
View Source
var ErrTooSmall = errors.New("payload too small")
ErrTooSmall is returned when the data being written is smaller than expected.
Functions ¶
This section is empty.
Types ¶
type Blobstore ¶
type Blobstore interface { // Put stores the bytes to the store and ensures it hashes to the passed // digest. Put(ctx context.Context, digest multihash.Multihash, size uint64, body io.Reader) error // Get retrieves the object identified by the passed digest. Returns nil and // [ErrNotFound] if the object does not exist. // // Note: data is not hashed on read. Get(ctx context.Context, digest multihash.Multihash, opts ...GetOption) (Object, error) }
type FileObject ¶
type FileObject struct {
// contains filtered or unexported fields
}
func (FileObject) Body ¶
func (o FileObject) Body() io.Reader
func (FileObject) Size ¶
func (o FileObject) Size() int64
type FileSystemer ¶
type FileSystemer interface { // FileSystem returns a filesystem interface for reading blobs. FileSystem() http.FileSystem }
FileSystemer exposes the filesystem interface for reading blobs.
type FsBlobstore ¶
type FsBlobstore struct {
// contains filtered or unexported fields
}
func NewFsBlobstore ¶
func NewFsBlobstore(rootdir string, tmpdir string) (*FsBlobstore, error)
NewFsBlobstore creates a Blobstore backed by the local filesystem. The tmpdir parameter is optional, defaulting to os.TempDir + "blobs".
func (*FsBlobstore) FileSystem ¶
func (b *FsBlobstore) FileSystem() http.FileSystem
FileSystem returns a filesystem interface for reading blobs.
type GetOption ¶
type GetOption func(cfg *options) error
GetOption is an option configuring byte retrieval from a blobstore.
type MapBlobstore ¶
type MapBlobstore struct {
// contains filtered or unexported fields
}
func NewMapBlobstore ¶
func NewMapBlobstore() *MapBlobstore
NewMapBlobstore creates a Blobstore backed by an in-memory map.
func (*MapBlobstore) FileSystem ¶
func (mb *MapBlobstore) FileSystem() http.FileSystem
Click to show internal directories.
Click to hide internal directories.