reflector.go/store/store.go

32 lines
1 KiB
Go
Raw Normal View History

2018-01-29 20:37:26 +01:00
package store
import (
2019-11-14 01:11:35 +01:00
"github.com/lbryio/lbry.go/v2/extras/errors"
"github.com/lbryio/lbry.go/v2/stream"
)
2018-02-07 21:21:20 +01:00
// BlobStore is an interface for 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
Get(hash string) (stream.Blob, error)
2018-09-20 17:24:36 +02:00
// Put the blob into the store
Put(hash string, blob stream.Blob) error
2018-09-20 17:24:36 +02:00
// Put an SD blob into the store
PutSD(hash string, blob stream.Blob) error
2018-09-20 17:24:36 +02:00
// Delete the blob from the store
Delete(hash string) error
}
2019-10-03 19:36:35 +02:00
// Blocklister is a store that supports blocking blobs to prevent their inclusion in the store.
2018-09-20 17:24:36 +02:00
type Blocklister interface {
// Block deletes the blob and prevents it from being uploaded in the future
Block(hash string) error
2019-10-03 19:36:35 +02:00
// Wants returns false if the hash exists in store or is blocked, true otherwise
2018-09-20 17:24:36 +02:00
Wants(hash string) (bool, error)
2018-01-29 20:37:26 +01:00
}
2018-02-07 21:21:20 +01: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")