Documentation
¶
Index ¶
- Variables
- type BlobStore
- type DBBackedS3Store
- func (d *DBBackedS3Store) Get(hash string) ([]byte, error)
- func (d *DBBackedS3Store) Has(hash string) (bool, error)
- func (d *DBBackedS3Store) HasFullStream(sdHash string) (bool, error)
- func (d *DBBackedS3Store) Put(hash string, blob []byte) error
- func (d *DBBackedS3Store) PutSD(hash string, blob []byte) error
- type FileBlobStore
- type MemoryBlobStore
- type S3BlobStore
Constants ¶
This section is empty.
Variables ¶
var ErrBlobNotFound = errors.Base("blob not found")
ErrBlobNotFound is a standard error when a blob is not found in the store.
Functions ¶
This section is empty.
Types ¶
type BlobStore ¶
type BlobStore interface { Has(string) (bool, error) Get(string) ([]byte, error) Put(string, []byte) error PutSD(string, []byte) error }
BlobStore is an interface with methods for consistently handling blob storage.
type DBBackedS3Store ¶
type DBBackedS3Store struct {
// contains filtered or unexported fields
}
DBBackedS3Store is an instance of an S3 Store that is backed by a DB for what is stored.
func NewDBBackedS3Store ¶
func NewDBBackedS3Store(s3 *S3BlobStore, db *db.SQL) *DBBackedS3Store
NewDBBackedS3Store returns an initialized store pointer.
func (*DBBackedS3Store) Get ¶
func (d *DBBackedS3Store) Get(hash string) ([]byte, error)
Get returns the byte slice of the blob or an error.
func (*DBBackedS3Store) Has ¶
func (d *DBBackedS3Store) Has(hash string) (bool, error)
Has returns T/F or Error ( if the DB errors ) if store contains the blob.
func (*DBBackedS3Store) HasFullStream ¶
func (d *DBBackedS3Store) HasFullStream(sdHash string) (bool, error)
HasFullStream checks if the full stream has been uploaded (i.e. if we have the sd blob and all the content blobs)
type FileBlobStore ¶
type FileBlobStore struct {
// contains filtered or unexported fields
}
FileBlobStore is a local disk store.
func NewFileBlobStore ¶
func NewFileBlobStore(dir string) *FileBlobStore
NewFileBlobStore returns an initialized file disk store pointer.
func (*FileBlobStore) Get ¶
func (f *FileBlobStore) Get(hash string) ([]byte, error)
Get returns the byte slice of the blob stored or will error if the blob doesn't exist.
func (*FileBlobStore) Has ¶
func (f *FileBlobStore) Has(hash string) (bool, error)
Has returns T/F or Error if it the blob stored already. It will error with any IO disk error.
type MemoryBlobStore ¶
type MemoryBlobStore struct {
// contains filtered or unexported fields
}
MemoryBlobStore is an in memory only blob store with no persistence.
func (*MemoryBlobStore) Get ¶
func (m *MemoryBlobStore) Get(hash string) ([]byte, error)
Get returns the blob byte slice if present and errors if the blob is not found.
func (*MemoryBlobStore) Has ¶
func (m *MemoryBlobStore) Has(hash string) (bool, error)
Has returns T/F if the blob is currently stored. It will never error.
type S3BlobStore ¶
type S3BlobStore struct {
// contains filtered or unexported fields
}
S3BlobStore is an S3 store
func NewS3BlobStore ¶
func NewS3BlobStore(awsID, awsSecret, region, bucket string) *S3BlobStore
NewS3BlobStore returns an initialized S3 store pointer.
func (*S3BlobStore) Get ¶
func (s *S3BlobStore) Get(hash string) ([]byte, error)
Get returns the blob slice if present or errors on S3.
func (*S3BlobStore) Has ¶
func (s *S3BlobStore) Has(hash string) (bool, error)
Has returns T/F or Error ( from S3 ) if the store contains the blob.