Documentation
¶
Overview ¶
Package decision implements the decision engine for the bitswap service.
Index ¶
- type Engine
- func (e *Engine) AddBlock(block blocks.Block)
- func (e *Engine) LedgerForPeer(p peer.ID) *Receipt
- func (e *Engine) MessageReceived(p peer.ID, m bsmsg.BitSwapMessage)
- func (e *Engine) MessageSent(p peer.ID, m bsmsg.BitSwapMessage)
- func (e *Engine) Outbox() <-chan (<-chan *Envelope)
- func (e *Engine) PeerConnected(p peer.ID)
- func (e *Engine) PeerDisconnected(p peer.ID)
- func (e *Engine) Peers() []peer.ID
- func (e *Engine) WantlistForPeer(p peer.ID) (out []wl.Entry)
- type Envelope
- type Receipt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine manages sending requested blocks to peers.
func NewEngine ¶
func NewEngine(ctx context.Context, bs bstore.Blockstore) *Engine
NewEngine creates a new block sending engine for the given block store
func (*Engine) AddBlock ¶
AddBlock is called to when a new block is received and added to a block store meaning there may be peers who want that block that we should send it to.
func (*Engine) LedgerForPeer ¶
LedgerForPeer returns aggregated data about blocks swapped and communication with a given peer.
func (*Engine) MessageReceived ¶
func (e *Engine) MessageReceived(p peer.ID, m bsmsg.BitSwapMessage)
MessageReceived performs book-keeping. Returns error if passed invalid arguments.
func (*Engine) MessageSent ¶
func (e *Engine) MessageSent(p peer.ID, m bsmsg.BitSwapMessage)
MessageSent is called when a message has successfully been sent out, to record changes.
func (*Engine) PeerConnected ¶
PeerConnected is called when a new peer connects, meaning we should start sending blocks.
func (*Engine) PeerDisconnected ¶
PeerDisconnected is called when a peer disconnects.