Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPaymentInterval = uint64(1 << 20)
DefaultPaymentInterval is the baseline interval, set to 1Mb if the miner does not explicitly set it otherwise
var DefaultPaymentIntervalIncrease = uint64(1 << 20)
DefaultPaymentIntervalIncrease is the amount interval increases on each payment, set to to 1Mb if the miner does not explicitly set it otherwise
var DefaultPricePerByte = abi.NewTokenAmount(2)
DefaultPricePerByte is the charge per byte retrieved if the miner does not specifically set it
var ErrConnectFailed = errors.New("cannot connect to any provided multiaddrs")
ErrConnectFailed is returned when a provider is unable to connect using any of the client's multiaddrs
var ErrNoAddrsProvided = errors.New("no client multiaddrs provided")
ErrNoAddrsProvided is returned when a client message is received that has no client multiaddrs.
Functions ¶
This section is empty.
Types ¶
type Network ¶
type Network interface { Start() error Stop() error Messages() <-chan []byte MultiAddrs() []string Connect(p peer.AddrInfo) error Send(context.Context, core.ProtocolID, peer.ID, []byte) error PeerID() peer.ID }
Network defines the libp2p network interface used by the Provider
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider ...
func NewProvider ¶
func NewProvider(net Network, s RetrievalProviderStore, cache RequestCache) *Provider
NewProvider returns a new Provider
func (*Provider) SetPaymentInterval ¶
SetPaymentInterval sets the provider's paymentInterval and paymentIntervalIncrease
func (*Provider) SetPricePerByte ¶
func (p *Provider) SetPricePerByte(price abi.TokenAmount)
SetPricePerByte sets the provider's pricePerByte
func (*Provider) SubscribeToQueries ¶
func (p *Provider) SubscribeToQueries(s ProviderSubscriber) Unsubscribe
SubscribeToQueries registers the given subscriber and calls it upon receiving queries
type ProviderSubscriber ¶
type RequestCache ¶
type RequestCache interface { // Put adds the cid to the cache or updates it if it already exists Put(cid.Cid) // Keys returns all the keys in the cache Keys() []cid.Cid // GetRecord returns the Record for the given cid GetRecord(cid.Cid) *cache.Record }
RequestCache is the interface for the provider's cache of requests
type RetrievalProviderStore ¶
type Unsubscribe ¶
type Unsubscribe func()