provider

package
v0.4.23 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Overview

Package provider 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 Provider

type Provider interface {
	// Run is used to begin processing the provider work
	Run()
	// Provide takes a cid and makes an attempt to announce it to the network
	Provide(cid.Cid) error
	// Close stops the provider
	Close() error
}

Provider announces blocks to the network

func NewOfflineProvider

func NewOfflineProvider() Provider

NewOfflineProvider creates a Provider that does nothing

func NewProvider

func NewProvider(ctx context.Context, queue *Queue, contentRouting routing.ContentRouting) Provider

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

type Queue

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

Queue provides a durable, FIFO interface to the datastore for storing cids

Durability just means that cids in the process of being provided when a crash or shutdown occurs will still be in the queue when the node is brought back online.

func NewQueue

func NewQueue(ctx context.Context, name string, ds datastore.Datastore) (*Queue, error)

NewQueue creates a queue for cids

func (*Queue) Close

func (q *Queue) Close() error

Close stops the queue

func (*Queue) Dequeue

func (q *Queue) Dequeue() <-chan cid.Cid

Dequeue returns a channel that if listened to will remove entries from the queue

func (*Queue) Enqueue

func (q *Queue) Enqueue(cid cid.Cid)

Enqueue puts a cid in the queue

Jump to

Keyboard shortcuts

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