Documentation ¶
Index ¶
- type Option
- func EngineBlockstoreWorkerCount(count int) Option
- func EngineTaskWorkerCount(count int) Option
- func HasBlockBufferSize(count int) Option
- func MaxCidSize(n uint) Option
- func MaxOutstandingBytesPerPeer(count int) Option
- func MaxQueuedWantlistEntriesPerPeer(count uint) Option
- func ProvideEnabled(enabled bool) Option
- func SetSendDontHaves(send bool) Option
- func TaskWorkerCount(count int) Option
- func WithPeerBlockRequestFilter(pbrf decision.PeerBlockRequestFilter) Option
- func WithPeerLedger(peerLedger decision.PeerLedger) Option
- func WithScoreLedger(scoreLedger decision.ScoreLedger) Option
- func WithTargetMessageSize(tms int) Option
- func WithTaskComparator(comparator decision.TaskComparator) Option
- func WithTracer(tap tracer.Tracer) Option
- type PeerBlockRequestFilter
- type PeerEntry
- type PeerLedger
- type Receipt
- type ScoreLedger
- type ScorePeerFunc
- type Server
- func (bs *Server) Close() error
- func (bs *Server) LedgerForPeer(p peer.ID) *decision.Receipt
- func (bs *Server) NotifyNewBlocks(ctx context.Context, blks ...blocks.Block) error
- func (bs *Server) PeerConnected(p peer.ID)
- func (bs *Server) PeerDisconnected(p peer.ID)
- func (*Server) ReceiveError(err error)
- func (bs *Server) ReceiveMessage(ctx context.Context, p peer.ID, incoming message.BitSwapMessage)
- func (bs *Server) ReceivedBlocks(from peer.ID, blks []blocks.Block)
- func (bs *Server) Stat() (Stat, error)
- func (bs *Server) WantlistForPeer(p peer.ID) []cid.Cid
- type Stat
- type TaskComparator
- type TaskInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Server)
func EngineBlockstoreWorkerCount ¶
EngineBlockstoreWorkerCount sets the number of worker threads used for blockstore operations in the decision engine
func EngineTaskWorkerCount ¶
EngineTaskWorkerCount sets the number of worker threads used inside the engine
func HasBlockBufferSize ¶
HasBlockBufferSize configure how big the new blocks buffer should be.
func MaxCidSize ¶
MaxCidSize limits how big CIDs we are willing to serve. We will ignore CIDs over this limit. It defaults to defaults.MaxCidSize. If it is 0 no limit is applied.
func MaxOutstandingBytesPerPeer ¶
MaxOutstandingBytesPerPeer describes approximately how much work we are will to have outstanding to a peer at any given time. Setting it to 0 will disable any limiting.
func MaxQueuedWantlistEntriesPerPeer ¶
MaxQueuedWantlistEntriesPerPeer limits how much individual entries each peer is allowed to send. If a peer send us more than this we will truncate newest entries. It defaults to defaults.MaxQueuedWantlistEntiresPerPeer.
func ProvideEnabled ¶
ProvideEnabled is an option for enabling/disabling provide announcements
func SetSendDontHaves ¶
SetSendDontHaves indicates what to do when the engine receives a want-block for a block that is not in the blockstore. Either - Send a DONT_HAVE message - Simply don't respond This option is only used for testing.
func TaskWorkerCount ¶
func WithPeerBlockRequestFilter ¶
func WithPeerBlockRequestFilter(pbrf decision.PeerBlockRequestFilter) Option
func WithPeerLedger ¶
func WithPeerLedger(peerLedger decision.PeerLedger) Option
WithPeerLedger configures the engine with a custom decision.PeerLedger.
func WithScoreLedger ¶
func WithScoreLedger(scoreLedger decision.ScoreLedger) Option
Configures the engine to use the given score decision logic.
func WithTargetMessageSize ¶
func WithTaskComparator ¶
func WithTaskComparator(comparator decision.TaskComparator) Option
WithTaskComparator configures custom task prioritization logic.
func WithTracer ¶
type PeerBlockRequestFilter ¶
type PeerBlockRequestFilter = decision.PeerBlockRequestFilter
type PeerLedger ¶
type PeerLedger = decision.PeerLedger
type ScoreLedger ¶
type ScoreLedger = decision.ScoreLedger
type ScorePeerFunc ¶
type ScorePeerFunc = decision.ScorePeerFunc
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, network bsnet.BitSwapNetwork, bstore blockstore.Blockstore, options ...Option) *Server
func (*Server) LedgerForPeer ¶
LedgerForPeer returns aggregated data about blocks swapped and communication with a given peer.
func (*Server) NotifyNewBlocks ¶
NotifyNewBlocks announces the existence of blocks to this bitswap service. The service will potentially notify its peers. Bitswap itself doesn't store new blocks. It's the caller responsibility to ensure that those blocks are available in the blockstore before calling this function.
func (*Server) PeerConnected ¶
func (*Server) PeerDisconnected ¶
func (*Server) ReceiveError ¶
func (*Server) ReceiveMessage ¶
func (*Server) ReceivedBlocks ¶
ReceivedBlocks notify the decision engine that a peer is well behaving and gave us usefull data, potentially increasing it's score and making us send them more data in exchange.
func (*Server) WantlistForPeer ¶
WantlistForPeer returns the currently understood list of blocks requested by a given peer.
type TaskComparator ¶
type TaskComparator = decision.TaskComparator