strategy

package
v0.0.0-...-c9e5fdf Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2014 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy interface {
	// Returns a slice of Peers with whom the local node has active sessions
	Peers() []peer.Peer

	// BlockIsWantedByPeer returns true if peer wants the block given by this
	// key
	BlockIsWantedByPeer(u.Key, peer.Peer) bool

	// ShouldSendTo(Peer) decides whether to send data to this Peer
	ShouldSendBlockToPeer(u.Key, peer.Peer) bool

	// Seed initializes the decider to a deterministic state
	Seed(int64)

	// MessageReceived records receipt of message for accounting purposes
	MessageReceived(peer.Peer, bsmsg.BitSwapMessage) error

	// MessageSent records sending of message for accounting purposes
	MessageSent(peer.Peer, bsmsg.BitSwapMessage) error

	NumBytesSentTo(peer.Peer) uint64

	NumBytesReceivedFrom(peer.Peer) uint64
}

func New

func New(nice bool) Strategy

TODO niceness should be on a per-peer basis. Use-case: Certain peers are "trusted" and/or controlled by a single human user. The user may want for these peers to exchange data freely

Jump to

Keyboard shortcuts

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