store

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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) MissingBlobsForKnownStream added in v1.0.3

func (d *DBBackedS3Store) MissingBlobsForKnownStream(sdHash string) ([]string, error)

MissingBlobsForKnownStream returns missing blobs for an existing stream WARNING: if the stream does NOT exist, no blob hashes will be returned, which looks like no blobs are missing

func (*DBBackedS3Store) Put

func (d *DBBackedS3Store) Put(hash string, blob []byte) error

Put stores the blob in the S3 store and stores the blob information in the DB.

func (*DBBackedS3Store) PutSD

func (d *DBBackedS3Store) PutSD(hash string, blob []byte) error

PutSD stores the SDBlob in the S3 store. It will return an error if the sd blob is missing the stream hash or if there is an error storing the blob information in the DB.

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.

func (*FileBlobStore) Put

func (f *FileBlobStore) Put(hash string, blob []byte) error

Put stores the blob on disk

func (*FileBlobStore) PutSD

func (f *FileBlobStore) PutSD(hash string, blob []byte) error

PutSD stores the sd blob on the disk

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.

func (*MemoryBlobStore) Put

func (m *MemoryBlobStore) Put(hash string, blob []byte) error

Put stores the blob in memory

func (*MemoryBlobStore) PutSD

func (m *MemoryBlobStore) PutSD(hash string, blob []byte) error

PutSD stores the sd blob in memory

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.

func (*S3BlobStore) Put

func (s *S3BlobStore) Put(hash string, blob []byte) error

Put stores the blob on S3 or errors if S3 connection errors.

func (*S3BlobStore) PutSD

func (s *S3BlobStore) PutSD(hash string, blob []byte) error

PutSD stores the sd blob on S3 or errors if S3 connection errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL