Ittt #52
4 changed files with 18 additions and 9 deletions
|
@ -13,6 +13,9 @@ import (
|
||||||
"github.com/lucas-clemente/quic-go/http3"
|
"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.
|
// Store is a blob store that gets blobs from a peer.
|
||||||
// It satisfies the store.BlobStore interface but cannot put or delete blobs.
|
// It satisfies the store.BlobStore interface but cannot put or delete blobs.
|
||||||
type Store struct {
|
type Store struct {
|
||||||
|
@ -81,17 +84,17 @@ func (p *Store) Get(hash string) (stream.Blob, shared.BlobTrace, error) {
|
||||||
|
|
||||||
// Put is not supported
|
// Put is not supported
|
||||||
func (p *Store) Put(hash string, blob stream.Blob) error {
|
func (p *Store) Put(hash string, blob stream.Blob) error {
|
||||||
panic("http3Store cannot put or delete blobs")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutSD is not supported
|
// PutSD is not supported
|
||||||
func (p *Store) PutSD(hash string, blob stream.Blob) error {
|
func (p *Store) PutSD(hash string, blob stream.Blob) error {
|
||||||
panic("http3Store cannot put or delete blobs")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete is not supported
|
// Delete is not supported
|
||||||
func (p *Store) Delete(hash string) error {
|
func (p *Store) Delete(hash string) error {
|
||||||
panic("http3Store cannot put or delete blobs")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete is not supported
|
// Delete is not supported
|
||||||
|
|
|
@ -8,6 +8,9 @@ import (
|
||||||
"github.com/lbryio/reflector.go/shared"
|
"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.
|
// Store is a blob store that gets blobs from a peer.
|
||||||
// It satisfies the store.BlobStore interface but cannot put or delete blobs.
|
// It satisfies the store.BlobStore interface but cannot put or delete blobs.
|
||||||
type Store struct {
|
type Store struct {
|
||||||
|
@ -56,17 +59,17 @@ func (p *Store) Get(hash string) (stream.Blob, shared.BlobTrace, error) {
|
||||||
|
|
||||||
// Put is not supported
|
// Put is not supported
|
||||||
func (p *Store) Put(hash string, blob stream.Blob) error {
|
func (p *Store) Put(hash string, blob stream.Blob) error {
|
||||||
panic("PeerStore cannot put or delete blobs")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutSD is not supported
|
// PutSD is not supported
|
||||||
func (p *Store) PutSD(hash string, blob stream.Blob) error {
|
func (p *Store) PutSD(hash string, blob stream.Blob) error {
|
||||||
panic("PeerStore cannot put or delete blobs")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete is not supported
|
// Delete is not supported
|
||||||
func (p *Store) Delete(hash string) error {
|
func (p *Store) Delete(hash string) error {
|
||||||
panic("PeerStore cannot put or delete blobs")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete is not supported
|
// Delete is not supported
|
||||||
|
|
|
@ -93,15 +93,15 @@ func (c *CloudFrontROStore) cfRequest(method, hash string) (int, io.ReadCloser,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CloudFrontROStore) Put(_ string, _ stream.Blob) error {
|
func (c *CloudFrontROStore) Put(_ string, _ stream.Blob) error {
|
||||||
panic("CloudFrontROStore cannot do writes. Use CloudFrontRWStore")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CloudFrontROStore) PutSD(_ string, _ stream.Blob) error {
|
func (c *CloudFrontROStore) PutSD(_ string, _ stream.Blob) error {
|
||||||
panic("CloudFrontROStore cannot do writes. Use CloudFrontRWStore")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CloudFrontROStore) Delete(_ string) error {
|
func (c *CloudFrontROStore) Delete(_ string) error {
|
||||||
panic("CloudFrontROStore cannot do writes. Use CloudFrontRWStore")
|
return errors.Err(ErrNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown shuts down the store gracefully
|
// Shutdown shuts down the store gracefully
|
||||||
|
|
|
@ -40,3 +40,6 @@ type lister interface {
|
||||||
|
|
||||||
//ErrBlobNotFound is a standard error when a blob is not found in the store.
|
//ErrBlobNotFound is a standard error when a blob is not found in the store.
|
||||||
var ErrBlobNotFound = errors.Base("blob not found")
|
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")
|
||||||
|
|
Loading…
Reference in a new issue