Documentation
¶
Overview ¶
Package blobstore implements the filesystem storage and simpathy/want managment for ssb-blobs.
Index ¶
- Constants
- Variables
- func New(basePath string) (ssb.BlobStore, error)
- type GetWithSize
- type WantManager
- func (wmgr *WantManager) AllWants() []ssb.BlobWant
- func (wmgr *WantManager) Close() error
- func (wmgr *WantManager) CreateWants(ctx context.Context, sink *muxrpc.ByteSink, edp muxrpc.Endpoint) luigi.Sink
- func (wmgr *WantManager) EmitBlob(n ssb.BlobStoreNotification) error
- func (wmgr *WantManager) Want(ref refs.BlobRef) error
- func (wmgr *WantManager) WantWithDist(ref refs.BlobRef, dist int64) error
- func (wmgr *WantManager) Wants(ref refs.BlobRef) bool
- type WantManagerOption
- type WantMsg
Constants ¶
const DefaultMaxSize = 5 * 1024 * 1024
DefaultMaxSize is 5 megabyte. Blobs that are biggere are not fetched.
Variables ¶
var ErrBlobBlocked = errors.New("ssb: unable to receive blob correctly")
ErrBlobBlocked is returned if the want manager is unable to receive a blob after multiple tries
var ErrNoSuchBlob = errors.New("ssb: no such blob")
ErrNoSuchBlob is returned if the requested blob isn't available
Functions ¶
Types ¶
type GetWithSize ¶
GetWithSize is a muxrpc argument helper. It can be used to request a blob named _key_ with a different maximum size than the default.
type WantManager ¶ added in v0.2.1
type WantManager struct { *broadcasts.BlobWantsBroadcast // contains filtered or unexported fields }
func NewWantManager ¶
func NewWantManager(bs ssb.BlobStore, opts ...WantManagerOption) *WantManager
NewWantManager returns the configured WantManager, using bs for storage and opts to configure it.
func (*WantManager) AllWants ¶ added in v0.2.1
func (wmgr *WantManager) AllWants() []ssb.BlobWant
func (*WantManager) Close ¶ added in v0.2.1
func (wmgr *WantManager) Close() error
func (*WantManager) CreateWants ¶ added in v0.2.1
func (wmgr *WantManager) CreateWants(ctx context.Context, sink *muxrpc.ByteSink, edp muxrpc.Endpoint) luigi.Sink
func (*WantManager) EmitBlob ¶ added in v0.2.1
func (wmgr *WantManager) EmitBlob(n ssb.BlobStoreNotification) error
func (*WantManager) WantWithDist ¶ added in v0.2.1
func (wmgr *WantManager) WantWithDist(ref refs.BlobRef, dist int64) error
type WantManagerOption ¶
type WantManagerOption func(*WantManager) error
WantManagerOption is used to tune different aspects of the WantManager.
func WantWithContext ¶
func WantWithContext(ctx context.Context) WantManagerOption
WantWithContext supplies a context to cancel its operations.
func WantWithLogger ¶
func WantWithLogger(l log.Logger) WantManagerOption
WantWithLogger sets up the logger which is used for debug and info output.
func WantWithMaxSize ¶
func WantWithMaxSize(sz uint) WantManagerOption
WantWithMaxSize can be used to change DefaultMaxSize
func WantWithMetrics ¶
func WantWithMetrics(g metrics.Gauge, ctr metrics.Counter) WantManagerOption
WantWithMetrics setup the metrics counters and gauges to monitor the want manager.
type WantMsg ¶
WantMsg is an array of _wants_, a blob reference with a distance.
func (WantMsg) MarshalJSON ¶
MarshalJSON turns a BlobWant slice into one object. for example: { ref1:dist1, ref2:dist2, ... }
func (*WantMsg) UnmarshalJSON ¶
UnmarshalJSON turns an object of {ref:dist, ...} relations into a slice of BlobWants.