Documentation ¶
Overview ¶
Package protocol implements the Block Exchange Protocol.
Index ¶
- Constants
- Variables
- func HasPermissionBits(bits uint32) bool
- func IsDeleted(bits uint32) bool
- func IsDirectory(bits uint32) bool
- func IsInvalid(bits uint32) bool
- func TotalInOut() (uint64, uint64)
- type BlockInfo
- type CloseMessage
- type ClusterConfigMessage
- func (o ClusterConfigMessage) AppendXDR(bs []byte) []byte
- func (o *ClusterConfigMessage) DecodeXDR(r io.Reader) error
- func (o ClusterConfigMessage) EncodeXDR(w io.Writer) (int, error)
- func (o *ClusterConfigMessage) GetOption(key string) string
- func (o ClusterConfigMessage) MarshalXDR() []byte
- func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error
- type Connection
- type EmptyMessage
- type FileInfo
- func (o FileInfo) AppendXDR(bs []byte) []byte
- func (o *FileInfo) DecodeXDR(r io.Reader) error
- func (o FileInfo) EncodeXDR(w io.Writer) (int, error)
- func (f FileInfo) IsDeleted() bool
- func (f FileInfo) IsInvalid() bool
- func (o FileInfo) MarshalXDR() []byte
- func (f FileInfo) Size() (bytes int64)
- func (f FileInfo) String() string
- func (o *FileInfo) UnmarshalXDR(bs []byte) error
- type FileInfoTruncated
- func (o FileInfoTruncated) AppendXDR(bs []byte) []byte
- func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error
- func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error)
- func (f FileInfoTruncated) IsDeleted() bool
- func (f FileInfoTruncated) IsInvalid() bool
- func (o FileInfoTruncated) MarshalXDR() []byte
- func (f FileInfoTruncated) Size() int64
- func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error
- type FileIntf
- type IndexMessage
- type Model
- type Node
- type NodeID
- type Option
- type Repository
- type RequestMessage
- type ResponseMessage
- type Statistics
Constants ¶
View Source
const ( FlagDeleted uint32 = 1 << 12 FlagInvalid = 1 << 13 FlagDirectory = 1 << 14 FlagNoPermBits = 1 << 15 )
View Source
const ( FlagIntroducer = 1 << 2 )
View Source
const (
BlockSize = 128 * 1024
)
Variables ¶
View Source
var ( ErrClusterHash = fmt.Errorf("configuration error: mismatched cluster hash") ErrClosed = errors.New("connection closed") )
View Source
var LocalNodeID = NodeID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
Functions ¶
func HasPermissionBits ¶ added in v0.8.10
func IsDirectory ¶ added in v0.8.10
func TotalInOut ¶ added in v0.8.10
Types ¶
type BlockInfo ¶
func (BlockInfo) MarshalXDR ¶ added in v0.6.0
func (*BlockInfo) UnmarshalXDR ¶ added in v0.6.0
type CloseMessage ¶ added in v0.9.0
type CloseMessage struct {
Reason string // max:1024
}
func (CloseMessage) AppendXDR ¶ added in v0.9.0
func (o CloseMessage) AppendXDR(bs []byte) []byte
func (*CloseMessage) DecodeXDR ¶ added in v0.9.0
func (o *CloseMessage) DecodeXDR(r io.Reader) error
func (CloseMessage) EncodeXDR ¶ added in v0.9.0
func (o CloseMessage) EncodeXDR(w io.Writer) (int, error)
func (CloseMessage) MarshalXDR ¶ added in v0.9.0
func (o CloseMessage) MarshalXDR() []byte
func (*CloseMessage) UnmarshalXDR ¶ added in v0.9.0
func (o *CloseMessage) UnmarshalXDR(bs []byte) error
type ClusterConfigMessage ¶ added in v0.8.0
type ClusterConfigMessage struct { ClientName string // max:64 ClientVersion string // max:64 Repositories []Repository // max:64 Options []Option // max:64 }
func (ClusterConfigMessage) AppendXDR ¶ added in v0.9.0
func (o ClusterConfigMessage) AppendXDR(bs []byte) []byte
func (*ClusterConfigMessage) DecodeXDR ¶ added in v0.8.0
func (o *ClusterConfigMessage) DecodeXDR(r io.Reader) error
func (ClusterConfigMessage) EncodeXDR ¶ added in v0.8.0
func (o ClusterConfigMessage) EncodeXDR(w io.Writer) (int, error)
func (*ClusterConfigMessage) GetOption ¶ added in v0.9.5
func (o *ClusterConfigMessage) GetOption(key string) string
func (ClusterConfigMessage) MarshalXDR ¶ added in v0.8.0
func (o ClusterConfigMessage) MarshalXDR() []byte
func (*ClusterConfigMessage) UnmarshalXDR ¶ added in v0.8.0
func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error
type Connection ¶
type EmptyMessage ¶ added in v0.9.0
type EmptyMessage struct{}
func (EmptyMessage) AppendXDR ¶ added in v0.9.0
func (o EmptyMessage) AppendXDR(bs []byte) []byte
func (*EmptyMessage) DecodeXDR ¶ added in v0.9.0
func (o *EmptyMessage) DecodeXDR(r io.Reader) error
func (EmptyMessage) EncodeXDR ¶ added in v0.9.0
func (o EmptyMessage) EncodeXDR(w io.Writer) (int, error)
func (EmptyMessage) MarshalXDR ¶ added in v0.9.0
func (o EmptyMessage) MarshalXDR() []byte
func (*EmptyMessage) UnmarshalXDR ¶ added in v0.9.0
func (o *EmptyMessage) UnmarshalXDR(bs []byte) error
type FileInfo ¶
type FileInfo struct { Name string // max:8192 Flags uint32 Modified int64 Version uint64 LocalVersion uint64 Blocks []BlockInfo }
func (FileInfo) MarshalXDR ¶ added in v0.6.0
func (*FileInfo) UnmarshalXDR ¶ added in v0.6.0
type FileInfoTruncated ¶ added in v0.9.3
type FileInfoTruncated struct { Name string // max:8192 Flags uint32 Modified int64 Version uint64 LocalVersion uint64 NumBlocks uint32 }
Used for unmarshalling a FileInfo structure but skipping the actual block list
func (FileInfoTruncated) AppendXDR ¶ added in v0.9.3
func (o FileInfoTruncated) AppendXDR(bs []byte) []byte
func (*FileInfoTruncated) DecodeXDR ¶ added in v0.9.3
func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error
func (FileInfoTruncated) EncodeXDR ¶ added in v0.9.3
func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error)
func (FileInfoTruncated) IsDeleted ¶ added in v0.9.3
func (f FileInfoTruncated) IsDeleted() bool
func (FileInfoTruncated) IsInvalid ¶ added in v0.9.11
func (f FileInfoTruncated) IsInvalid() bool
func (FileInfoTruncated) MarshalXDR ¶ added in v0.9.3
func (o FileInfoTruncated) MarshalXDR() []byte
func (FileInfoTruncated) Size ¶ added in v0.9.3
func (f FileInfoTruncated) Size() int64
Returns a statistical guess on the size, not the exact figure
func (*FileInfoTruncated) UnmarshalXDR ¶ added in v0.9.3
func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error
type IndexMessage ¶ added in v0.6.0
func (IndexMessage) AppendXDR ¶ added in v0.9.0
func (o IndexMessage) AppendXDR(bs []byte) []byte
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 NodeID, repo string, files []FileInfo) // An index update was received from the peer node IndexUpdate(nodeID NodeID, repo string, files []FileInfo) // A request was made by the peer node Request(nodeID NodeID, repo string, name string, offset int64, size int) ([]byte, error) // A cluster configuration message was received ClusterConfig(nodeID NodeID, config ClusterConfigMessage) // The peer node closed the connection Close(nodeID NodeID, err error) }
type Node ¶ added in v0.8.0
func (Node) MarshalXDR ¶ added in v0.8.0
func (*Node) UnmarshalXDR ¶ added in v0.8.0
type NodeID ¶ added in v0.9.0
type NodeID [32]byte
func NewNodeID ¶ added in v0.9.0
NewNodeID generates a new node ID from the raw bytes of a certificate
func NodeIDFromBytes ¶ added in v0.9.0
func NodeIDFromString ¶ added in v0.9.0
func (*NodeID) MarshalText ¶ added in v0.9.0
func (NodeID) String ¶ added in v0.9.0
String returns the canonical string representation of the node ID
func (*NodeID) UnmarshalText ¶ added in v0.9.0
type Option ¶ added in v0.6.0
func (Option) MarshalXDR ¶ added in v0.6.0
func (*Option) UnmarshalXDR ¶ added in v0.6.0
type Repository ¶ added in v0.8.0
func (Repository) AppendXDR ¶ added in v0.9.0
func (o Repository) AppendXDR(bs []byte) []byte
func (Repository) EncodeXDR ¶ added in v0.8.0
func (o Repository) EncodeXDR(w io.Writer) (int, error)
func (Repository) MarshalXDR ¶ added in v0.8.0
func (o Repository) MarshalXDR() []byte
func (*Repository) UnmarshalXDR ¶ added in v0.8.0
func (o *Repository) UnmarshalXDR(bs []byte) error
type RequestMessage ¶ added in v0.6.0
type RequestMessage struct { Repository string // max:64 Name string // max:8192 Offset uint64 Size uint32 }
func (RequestMessage) AppendXDR ¶ added in v0.9.0
func (o RequestMessage) AppendXDR(bs []byte) []byte
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
type ResponseMessage ¶ added in v0.9.0
type ResponseMessage struct {
Data []byte
}
func (ResponseMessage) AppendXDR ¶ added in v0.9.0
func (o ResponseMessage) AppendXDR(bs []byte) []byte
func (*ResponseMessage) DecodeXDR ¶ added in v0.9.0
func (o *ResponseMessage) DecodeXDR(r io.Reader) error
func (ResponseMessage) EncodeXDR ¶ added in v0.9.0
func (o ResponseMessage) EncodeXDR(w io.Writer) (int, error)
func (ResponseMessage) MarshalXDR ¶ added in v0.9.0
func (o ResponseMessage) MarshalXDR() []byte
func (*ResponseMessage) UnmarshalXDR ¶ added in v0.9.0
func (o *ResponseMessage) UnmarshalXDR(bs []byte) error
Click to show internal directories.
Click to hide internal directories.