Documentation ¶
Index ¶
- Constants
- type GroupReceiverImpl
- type HostV2
- func (host *HostV2) AddPeer(p *p2p.Peer) error
- func (host *HostV2) Close() error
- func (host *HostV2) ConnectHostPeer(peer p2p.Peer)
- func (host *HostV2) GetID() libp2p_peer.ID
- func (host *HostV2) GetP2PHost() libp2p_host.Host
- func (host *HostV2) GetPeerCount() int
- func (host *HostV2) GetSelfPeer() p2p.Peer
- func (host *HostV2) GroupReceiver(group nodeconfig.GroupID) (receiver p2p.GroupReceiver, err error)
- func (host *HostV2) Peerstore() libp2p_peerstore.Peerstore
- func (host *HostV2) SendMessageToGroups(groups []nodeconfig.GroupID, msg []byte) (err error)
Constants ¶
View Source
const ( // BatchSizeInByte The batch size in byte (64MB) in which we return data BatchSizeInByte = 1 << 16 // ProtocolID The ID of protocol used in stream handling. ProtocolID = "/harmony/0.0.1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroupReceiverImpl ¶
type GroupReceiverImpl struct {
// contains filtered or unexported fields
}
GroupReceiverImpl is a multicast group receiver implementation.
func (*GroupReceiverImpl) Close ¶
func (r *GroupReceiverImpl) Close() error
Close closes this receiver.
func (*GroupReceiverImpl) Receive ¶
func (r *GroupReceiverImpl) Receive(ctx context.Context) ( msg []byte, sender libp2p_peer.ID, err error, )
Receive receives a message.
type HostV2 ¶
type HostV2 struct {
// contains filtered or unexported fields
}
HostV2 is the version 2 p2p host
func New ¶
func New(self *p2p.Peer, priKey libp2p_crypto.PrivKey) *HostV2
New creates a host for p2p communication
func (*HostV2) ConnectHostPeer ¶
ConnectHostPeer connects to peer host
func (*HostV2) GetP2PHost ¶
func (host *HostV2) GetP2PHost() libp2p_host.Host
GetP2PHost returns the p2p.Host
func (*HostV2) GroupReceiver ¶
func (host *HostV2) GroupReceiver(group nodeconfig.GroupID) ( receiver p2p.GroupReceiver, err error, )
GroupReceiver returns a receiver of messages sent to a multicast group. See the GroupReceiver interface for details.
func (*HostV2) Peerstore ¶
func (host *HostV2) Peerstore() libp2p_peerstore.Peerstore
Peerstore returns the peer store
func (*HostV2) SendMessageToGroups ¶
func (host *HostV2) SendMessageToGroups(groups []nodeconfig.GroupID, msg []byte) (err error)
SendMessageToGroups sends a message to one or more multicast groups. It returns a nil error if and only if it has succeeded to schedule the given message for sending.
Click to show internal directories.
Click to hide internal directories.