Documentation ¶
Overview ¶
Package p2p provides the parallel file transport in the P2P network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
Node is the framework used for file transport in P2P network.
func (*Node) NewMessageData ¶
func (n *Node) NewMessageData(messageID string, gossip bool) *pb.MessageData
NewMessageData generate message data shared between all node's p2p protocols messageID: unique for requests, copied from request for responses
type SeaDownloadConfirmProtocol ¶
type SeaDownloadConfirmProtocol struct {
// contains filtered or unexported fields
}
SeaDownloadConfirmProtocol provides listener for download confirm protobuf.
func NewSeaDownloadConfirmProtocol ¶
func NewSeaDownloadConfirmProtocol(node *SeaNode) *SeaDownloadConfirmProtocol
NewSeaDownloadConfirmProtocol is the construct for SeaDownloadConfirmProtocol
type SeaDownloadProtocol ¶
type SeaDownloadProtocol struct {
// contains filtered or unexported fields
}
SeaDownloadProtocol provides listener for download request protobuf and sending download response protobuf.
func NewSeaDownloadProtocol ¶
func NewSeaDownloadProtocol(node *SeaNode) *SeaDownloadProtocol
NewSeaDownloadProtocol is the construct for SeaDownloadProtocol.
type SeaNode ¶
type SeaNode struct { *lib.ClientFramework *Node *SeaUploadQueryProtocol *SeaUploadProtocol *SeaOperationProtocol *SeaDownloadProtocol *SeaDownloadConfirmProtocol // contains filtered or unexported fields }
SeaNode is the P2P network node for sea providing storage.
func NewSeaNode ¶
func NewSeaNode(c *lib.ClientFramework, storagePath string, size int64, host p2pHost.Host) (*SeaNode, error)
NewSeaNode is the construct for SeaNode.
func (*SeaNode) SendUserOperations ¶
func (s *SeaNode) SendUserOperations()
SendUserOperations send users' operations for transaction.
type SeaOperationProtocol ¶
type SeaOperationProtocol struct {
// contains filtered or unexported fields
}
SeaOperationProtocol provides listener for operation request protobuf.
func NewSeaOperationProtocol ¶
func NewSeaOperationProtocol(node *SeaNode) *SeaOperationProtocol
NewSeaOperationProtocol is the construct for SeaOperationProtocol.
type SeaUploadProtocol ¶
type SeaUploadProtocol struct {
// contains filtered or unexported fields
}
SeaUploadProtocol provides listener for upload request protobuf and sending upload response protobuf.
func NewSeaUploadProtocol ¶
func NewSeaUploadProtocol(node *SeaNode) *SeaUploadProtocol
NewSeaUploadProtocol is the construct for SeaUploadProtocol.
type SeaUploadQueryProtocol ¶
type SeaUploadQueryProtocol struct {
// contains filtered or unexported fields
}
SeaUploadQueryProtocol provides listener for upload query request protobuf and sending upload query response protobuf.
func NewSeaUploadQueryProtocol ¶
func NewSeaUploadQueryProtocol(node *SeaNode) *SeaUploadQueryProtocol
NewSeaUploadQueryProtocol is the construct for SeaUploadQueryProtocol.
type UserDownloadProtocol ¶
type UserDownloadProtocol struct {
// contains filtered or unexported fields
}
UserDownloadProtocol provides sending download request protobuf and listener for download response protobuf.
func NewUserDownloadProtocol ¶
func NewUserDownloadProtocol(node *UserNode) *UserDownloadProtocol
NewUserDownloadProtocol is the construct for UserDownloadProtocol
func (*UserDownloadProtocol) SendDownloadProtocol ¶
func (p *UserDownloadProtocol) SendDownloadProtocol(peerID p2pPeer.ID, dst, owner, hash string, size int64) error
SendDownloadProtocol tag the information of download request then send it.
type UserNode ¶
type UserNode struct { *lib.ClientFramework *Node *UserUploadQueryProtocol *UserUploadProtocol *UserOperationProtocol *UserDownloadProtocol // contains filtered or unexported fields }
UserNode is the P2P network node for user upload and download file.
func NewUserNode ¶
func NewUserNode(host p2pHost.Host, cli *lib.ClientFramework) *UserNode
NewUserNode is the construct for UserNode.
func (*UserNode) Download ¶
Download start download file process. Firstly, generate information for downloaded file. Send download request to start download process. After download finished, the downloaded file will be verify by stored information.
type UserOperationProtocol ¶
type UserOperationProtocol struct {
// contains filtered or unexported fields
}
UserOperationProtocol provides sending operation request protobuf.
func NewUserOperationProtocol ¶
func NewUserOperationProtocol(n *UserNode) *UserOperationProtocol
NewUserOperationProtocol is the construct for UserOperationProtocol.
type UserUploadProtocol ¶
type UserUploadProtocol struct {
// contains filtered or unexported fields
}
UserUploadProtocol provides sending upload request protobuf and listener for upload response protobuf.
func NewUserUploadProtocol ¶
func NewUserUploadProtocol(node *UserNode) *UserUploadProtocol
NewUserUploadProtocol is the construct for UserUploadProtocol.
type UserUploadQueryProtocol ¶
type UserUploadQueryProtocol struct {
// contains filtered or unexported fields
}
UserUploadQueryProtocol provides sending upload query request protobuf.
func NewUserUploadQueryProtocol ¶
func NewUserUploadQueryProtocol(node *UserNode) *UserUploadQueryProtocol
NewUserUploadQueryProtocol is the construct for UserUploadQueryProtocol.
func (*UserUploadQueryProtocol) SendUploadQuery ¶
SendUploadQuery send upload query protobuf.