when reflecting a sdblob, insert all the stream and intermediate blobs using a transaction #50

Closed
shyba wants to merge 39 commits from insert_under_tx into master
5 changed files with 15 additions and 18 deletions
Showing only changes of commit 8cb7389619 - Show all commits

View file

@ -13,9 +13,6 @@ import (
"github.com/lucas-clemente/quic-go/http3"
)
//ErrNotImplemented is a standard error when a store that implements the store interface does not implement a method
var ErrNotImplemented = errors.Base("this store does not implement this method")
// Store is a blob store that gets blobs from a peer.
// It satisfies the store.BlobStore interface but cannot put or delete blobs.
type Store struct {
@ -84,17 +81,17 @@ func (p *Store) Get(hash string) (stream.Blob, shared.BlobTrace, error) {
// Put is not supported
func (p *Store) Put(hash string, blob stream.Blob) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
// PutSD is not supported
func (p *Store) PutSD(hash string, blob stream.Blob) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
// Delete is not supported
func (p *Store) Delete(hash string) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
// Delete is not supported

View file

@ -8,9 +8,6 @@ import (
"github.com/lbryio/reflector.go/shared"
)
//ErrNotImplemented is a standard error when a store that implements the store interface does not implement a method
var ErrNotImplemented = errors.Base("this store does not implement this method")
// Store is a blob store that gets blobs from a peer.
// It satisfies the store.BlobStore interface but cannot put or delete blobs.
type Store struct {
@ -59,17 +56,17 @@ func (p *Store) Get(hash string) (stream.Blob, shared.BlobTrace, error) {
// Put is not supported
func (p *Store) Put(hash string, blob stream.Blob) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
// PutSD is not supported
func (p *Store) PutSD(hash string, blob stream.Blob) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
// Delete is not supported
func (p *Store) Delete(hash string) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
// Delete is not supported

6
shared/errors.go Normal file
View file

@ -0,0 +1,6 @@
package shared
import "github.com/lbryio/lbry.go/v2/extras/errors"
//ErrNotImplemented is a standard error when a store that implements the store interface does not implement a method
var ErrNotImplemented = errors.Base("this store does not implement this method")

View file

@ -93,15 +93,15 @@ func (c *CloudFrontROStore) cfRequest(method, hash string) (int, io.ReadCloser,
}
func (c *CloudFrontROStore) Put(_ string, _ stream.Blob) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
func (c *CloudFrontROStore) PutSD(_ string, _ stream.Blob) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
func (c *CloudFrontROStore) Delete(_ string) error {
return errors.Err(ErrNotImplemented)
return errors.Err(shared.ErrNotImplemented)
}
// Shutdown shuts down the store gracefully

View file

@ -40,6 +40,3 @@ type lister interface {
//ErrBlobNotFound is a standard error when a blob is not found in the store.
var ErrBlobNotFound = errors.Base("blob not found")
//ErrNotImplemented is a standard error when a store that implements this interface does not implement a method
var ErrNotImplemented = errors.Base("this store does not implement this method")