Documentation ¶
Index ¶
Constants ¶
View Source
const ( FlagDeleted = 1 << 12 FlagInvalid = 1 << 13 )
Variables ¶
View Source
var ErrClosed = errors.New("Connection closed")
View Source
var ErrFieldLengthExceeded = errors.New("Raw bytes field size exceeds limit")
Functions ¶
Types ¶
type Connection ¶
func NewConnection ¶
func (*Connection) Close ¶
func (c *Connection) Close(err error)
func (*Connection) Index ¶
func (c *Connection) Index(idx []FileInfo)
Index writes the list of file information to the connected peer node
func (*Connection) Ping ¶
func (c *Connection) Ping() bool
func (*Connection) Request ¶
Request returns the bytes for the specified block after fetching them from the connected peer.
func (*Connection) Statistics ¶
func (c *Connection) Statistics() Statistics
func (*Connection) Stop ¶
func (c *Connection) Stop()
type Model ¶
type Model interface { // An index was received from the peer node Index(nodeID string, files []FileInfo) // An index update was received from the peer node IndexUpdate(nodeID string, files []FileInfo) // A request was made by the peer node Request(nodeID, name string, offset uint64, size uint32, hash []byte) ([]byte, error) // The peer node closed the connection Close(nodeID string, err error) }
Click to show internal directories.
Click to hide internal directories.