Documentation ¶
Overview ¶
Package simple implements structures and methods to provide blocks, keep track of which blocks are provided, and to allow those blocks to be reprovided.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("reprovider service stopped")
ErrClosed is returned by Trigger when operating on a closed reprovider.
Functions ¶
This section is empty.
Types ¶
type KeyChanFunc ¶
KeyChanFunc is function streaming CIDs to pass to content routing
func NewBlockstoreProvider ¶
func NewBlockstoreProvider(bstore blocks.Blockstore) KeyChanFunc
NewBlockstoreProvider returns key provider using bstore.AllKeysChan
func NewPinnedProvider ¶
func NewPinnedProvider(onlyRoots bool, pinning Pinner, dag ipld.DAGService) KeyChanFunc
NewPinnedProvider returns provider supplying pinned keys
type Option ¶ added in v0.1.1
type Option func(*Provider)
Option defines the functional option type that can be used to configure provider instances
func MaxWorkers ¶ added in v0.1.1
MaxWorkers is an option to set the max workers on a provider
func WithTimeout ¶ added in v0.1.1
WithTimeout is an option to set a timeout on a provider
type Pinner ¶
type Pinner interface { DirectKeys(ctx context.Context) ([]cid.Cid, error) RecursiveKeys(ctx context.Context) ([]cid.Cid, error) }
Pinner interface defines how the simple.Reprovider wants to interact with a Pinning service
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider announces blocks to the network
func NewProvider ¶
func NewProvider(ctx context.Context, queue *q.Queue, contentRouting routing.ContentRouting, options ...Option) *Provider
NewProvider creates a provider that announces blocks to the network using a content router
type Reprovider ¶
type Reprovider struct {
// contains filtered or unexported fields
}
Reprovider reannounces blocks to the network
func NewReprovider ¶
func NewReprovider(ctx context.Context, reprovideIniterval time.Duration, rsys routing.ContentRouting, keyProvider KeyChanFunc) *Reprovider
NewReprovider creates new Reprovider instance.
func (*Reprovider) Reprovide ¶
func (rp *Reprovider) Reprovide() error
Reprovide registers all keys given by rp.keyProvider to libp2p content routing
func (*Reprovider) Run ¶
func (rp *Reprovider) Run()
Run re-provides keys with 'tick' interval or when triggered