storj/storage/blob.go

33 lines
806 B
Go
Raw Normal View History

2018-10-01 12:29:27 +01:00
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
2018-09-28 07:59:27 +01:00
package storage
import (
"context"
"io"
)
// BlobRef is an unique reference to a blob
type BlobRef [32]byte
// ReadSeekCloser is an interface that groups Read, ReadAt, Seek and Close.
type ReadSeekCloser interface {
io.Reader
io.ReaderAt
io.Seeker
io.Closer
Size() int64
}
// Blobs is a blob storage interface
type Blobs interface {
// Load loads blob with the specified reference
Load(context.Context, BlobRef) (ReadSeekCloser, error)
// Delete deletes the blob with the specified reference
Delete(context.Context, BlobRef) error
// Store stores blob from reader
// optionally takes a size argument for improvements, -1 is unknown size
Store(ctx context.Context, r io.Reader, size int64) (BlobRef, error)
}