Documentation ¶
Overview ¶
Package protocol implements the Block Exchange Protocol.
Index ¶
Constants ¶
View Source
const ( FlagDeleted uint32 = 1 << 12 FlagInvalid = 1 << 13 )
View Source
const BlockSize = 128 * 1024
Variables ¶
View Source
var ( ErrClusterHash = fmt.Errorf("configuration error: mismatched cluster hash") ErrClosed = errors.New("connection closed") )
Functions ¶
This section is empty.
Types ¶
type BlockInfo ¶
func (BlockInfo) MarshalXDR ¶ added in v0.6.0
func (*BlockInfo) UnmarshalXDR ¶ added in v0.6.0
type Connection ¶
func NewConnection ¶
func (*Connection) ID ¶
func (c *Connection) ID() string
func (*Connection) Index ¶
func (c *Connection) Index(repo string, idx []FileInfo)
Index writes the list of file information to the connected peer node
func (*Connection) Option ¶ added in v0.5.0
func (c *Connection) Option(key string) string
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 FileInfo ¶
type FileInfo struct { Name string // max:1024 Flags uint32 Modified int64 Version uint32 Blocks []BlockInfo // max:100000 }
func (FileInfo) MarshalXDR ¶ added in v0.6.0
func (*FileInfo) UnmarshalXDR ¶ added in v0.6.0
type IndexMessage ¶ added in v0.6.0
func (*IndexMessage) DecodeXDR ¶ added in v0.6.0
func (o *IndexMessage) DecodeXDR(r io.Reader) error
func (IndexMessage) EncodeXDR ¶ added in v0.6.0
func (o IndexMessage) EncodeXDR(w io.Writer) (int, error)
func (IndexMessage) MarshalXDR ¶ added in v0.6.0
func (o IndexMessage) MarshalXDR() []byte
func (*IndexMessage) UnmarshalXDR ¶ added in v0.6.0
func (o *IndexMessage) UnmarshalXDR(bs []byte) error
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, repo string, name string, offset int64, size int) ([]byte, error) // The peer node closed the connection Close(nodeID string, err error) }
type Option ¶ added in v0.6.0
func (Option) MarshalXDR ¶ added in v0.6.0
func (*Option) UnmarshalXDR ¶ added in v0.6.0
type OptionsMessage ¶ added in v0.6.0
type OptionsMessage struct {
Options []Option // max:64
}
func (*OptionsMessage) DecodeXDR ¶ added in v0.6.0
func (o *OptionsMessage) DecodeXDR(r io.Reader) error
func (OptionsMessage) EncodeXDR ¶ added in v0.6.0
func (o OptionsMessage) EncodeXDR(w io.Writer) (int, error)
func (OptionsMessage) MarshalXDR ¶ added in v0.6.0
func (o OptionsMessage) MarshalXDR() []byte
func (*OptionsMessage) UnmarshalXDR ¶ added in v0.6.0
func (o *OptionsMessage) UnmarshalXDR(bs []byte) error
type RequestMessage ¶ added in v0.6.0
type RequestMessage struct { Repository string // max:64 Name string // max:1024 Offset uint64 Size uint32 }
func (*RequestMessage) DecodeXDR ¶ added in v0.6.0
func (o *RequestMessage) DecodeXDR(r io.Reader) error
func (RequestMessage) EncodeXDR ¶ added in v0.6.0
func (o RequestMessage) EncodeXDR(w io.Writer) (int, error)
func (RequestMessage) MarshalXDR ¶ added in v0.6.0
func (o RequestMessage) MarshalXDR() []byte
func (*RequestMessage) UnmarshalXDR ¶ added in v0.6.0
func (o *RequestMessage) UnmarshalXDR(bs []byte) error
Click to show internal directories.
Click to hide internal directories.