simple

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0, MIT Imports: 13 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

This section is empty.

Functions

This section is empty.

Types

type KeyChanFunc

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

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 Pinner

type Pinner interface {
	DirectKeys() []cid.Cid
	RecursiveKeys() []cid.Cid
}

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) *Provider

NewProvider creates a provider that announces blocks to the network using a content router

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

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) 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 reprovision process in rp.Run and waits for it

Jump to

Keyboard shortcuts

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