simple

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2023 License: Apache-2.0, MIT Imports: 15 Imported by: 18

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

View Source
var ErrClosed = errors.New("reprovider service stopped")

ErrClosed is returned by Trigger when operating on a closed reprovider.

Deprecated: use github.com/ipfs/boxo/provider/simple.ErrClosed

Functions

This section is empty.

Types

type KeyChanFunc deprecated

type KeyChanFunc func(context.Context) (<-chan cid.Cid, error)

KeyChanFunc is function streaming CIDs to pass to content routing

Deprecated: use github.com/ipfs/boxo/provider/simple.KeyChanFunc

func NewBlockstoreProvider deprecated

func NewBlockstoreProvider(bstore blocks.Blockstore) KeyChanFunc

NewBlockstoreProvider returns key provider using bstore.AllKeysChan

Deprecated: use github.com/ipfs/boxo/provider/simple.NewBlockstoreProvider

func NewPinnedProvider deprecated

func NewPinnedProvider(onlyRoots bool, pinning Pinner, fetchConfig fetcher.Factory) KeyChanFunc

NewPinnedProvider returns provider supplying pinned keys

Deprecated: use github.com/ipfs/boxo/provider/simple.NewPinnedProvider

type Option deprecated added in v0.1.1

type Option func(*Provider)

Option defines the functional option type that can be used to configure provider instances

Deprecated: use github.com/ipfs/boxo/provider/simple.Option

func MaxWorkers deprecated added in v0.1.1

func MaxWorkers(count int) Option

MaxWorkers is an option to set the max workers on a provider

Deprecated: use github.com/ipfs/boxo/provider/simple.MaxWorkers

func WithTimeout deprecated added in v0.1.1

func WithTimeout(timeout time.Duration) Option

WithTimeout is an option to set a timeout on a provider

Deprecated: use github.com/ipfs/boxo/provider/simple.WithTimeout

type Pinner deprecated

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

Deprecated: use github.com/ipfs/boxo/provider/simple.Pinner

type Provider deprecated

type Provider struct {
	// contains filtered or unexported fields
}

Provider announces blocks to the network

Deprecated: use github.com/ipfs/boxo/provider/simple.Provider

func NewProvider deprecated

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

Deprecated: use github.com/ipfs/boxo/provider/simple.NewProvider

func (*Provider) Close

func (p *Provider) Close() error

Close stops the provider

func (*Provider) Provide

func (p *Provider) Provide(root cid.Cid) error

Provide the given cid using specified strategy.

func (*Provider) Run

func (p *Provider) Run()

Run workers to handle provide requests.

type Reprovider deprecated

type Reprovider struct {
	// contains filtered or unexported fields
}

Reprovider reannounces blocks to the network

Deprecated: use github.com/ipfs/boxo/provider/simple.Reprovider

func NewReprovider deprecated

func NewReprovider(ctx context.Context, reprovideInterval time.Duration, rsys routing.ContentRouting, keyProvider KeyChanFunc) *Reprovider

NewReprovider creates new Reprovider instance.

Deprecated: use github.com/ipfs/boxo/provider/simple.NewReprovider

func (*Reprovider) Close

func (rp *Reprovider) Close() error

Close the reprovider

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

func (*Reprovider) Trigger

func (rp *Reprovider) Trigger(ctx context.Context) error

Trigger starts the reprovision process in rp.Run and waits for it to finish.

Returns an error if a reprovide is already in progress.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL