2018-01-29 20:37:26 +01:00
|
|
|
package store
|
|
|
|
|
2019-01-09 23:52:30 +01:00
|
|
|
import "github.com/lbryio/lbry.go/extras/errors"
|
2018-02-07 21:21:20 +01:00
|
|
|
|
2018-05-30 03:38:55 +02:00
|
|
|
// BlobStore is an interface with methods for consistently handling blob storage.
|
2018-01-29 20:37:26 +01:00
|
|
|
type BlobStore interface {
|
2018-09-20 17:24:36 +02:00
|
|
|
// Does blob exist in the store
|
|
|
|
Has(hash string) (bool, error)
|
|
|
|
// Get the blob from the store
|
2018-10-08 19:29:05 +02:00
|
|
|
Get(hash string) ([]byte, error)
|
2018-09-20 17:24:36 +02:00
|
|
|
// Put the blob into the store
|
|
|
|
Put(hash string, blob []byte) error
|
|
|
|
// Put an SD blob into the store
|
|
|
|
PutSD(hash string, blob []byte) error
|
|
|
|
// Delete the blob from the store
|
|
|
|
Delete(hash string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type Blocklister interface {
|
|
|
|
// Block deletes the blob and prevents it from being uploaded in the future
|
|
|
|
Block(hash string) error
|
|
|
|
// Wants returns false if the hash exists or is blocked, true otherwise
|
|
|
|
Wants(hash string) (bool, error)
|
2018-01-29 20:37:26 +01:00
|
|
|
}
|
2018-02-07 21:21:20 +01:00
|
|
|
|
2018-05-30 03:38:55 +02:00
|
|
|
//ErrBlobNotFound is a standard error when a blob is not found in the store.
|
2018-02-07 21:21:20 +01:00
|
|
|
var ErrBlobNotFound = errors.Base("blob not found")
|