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) ID ¶
func (c *Connection) ID() string
func (*Connection) Index ¶
func (c *Connection) Index(idx []FileInfo)
Index writes the list of file information to the connected peer node
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
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.