provider.go 811 Bytes
Newer Older
1 2 3 4
package provider

import (
	"context"
5
	"github.com/ipfs/go-cid"
6 7 8
	logging "github.com/ipfs/go-log"
)

9 10 11 12
var (
	// StrategicProvidingEnabled toggles between the original providing mechanism
	// and the new strategic providing system
	StrategicProvidingEnabled = false
13

14 15
	log = logging.Logger("provider")
)
16

17
// Provider announces blocks to the network
18
type Provider interface {
19
	// Run is used to begin processing the provider work
20
	Run()
21
	// Provide takes a cid and makes an attempt to announce it to the network
22
	Provide(cid.Cid) error
23 24
	// Close stops the provider
	Close() error
25 26
}

27 28 29 30 31 32
// Reprovider reannounces blocks to the network
type Reprovider interface {
	// Run is used to begin processing the reprovider work and waiting for reprovide triggers
	Run()
	// Trigger a reprovide
	Trigger(context.Context) error
33
}