Documentation ¶
Index ¶
- func ConvertHashToGID(h common.Hash) boson.Address
- func GenerateGID(name string) boson.Address
- func RandomPeer(peers []boson.Address) boson.Address
- func RandomPeersLimit(peers []boson.Address, limit int) []boson.Address
- type Group
- type GroupInterface
- type GroupMessage
- type GroupPeers
- type LogContent
- type Message
- type NotifyStatus
- type Option
- type PeersSubClient
- type SendOption
- type SendStreamCh
- type Service
- func (s *Service) API() rpc.API
- func (s *Service) AddGroup(groups []model.ConfigNodeGroup) error
- func (s *Service) Close() error
- func (s *Service) GetGroupPeers(groupName string) (out *GroupPeers, err error)
- func (s *Service) GetOptimumPeer(groupName string) (peer boson.Address, err error)
- func (s *Service) GetSendStream(ctx context.Context, gid, dest boson.Address) (out SendStreamCh, err error)
- func (s *Service) Handshake(ctx context.Context, addr boson.Address) (err error)
- func (s *Service) HandshakeIncoming(ctx context.Context, peer p2p.Peer, stream p2p.Stream) (err error)
- func (s *Service) Multicast(info *pb.MulticastMsg, skip ...boson.Address) error
- func (s *Service) Protocol() p2p.ProtocolSpec
- func (s *Service) RemoveGroup(gid boson.Address, gType model.GType) error
- func (s *Service) Send(ctx context.Context, data []byte, gid, dest boson.Address) (err error)
- func (s *Service) SendReceive(ctx context.Context, data []byte, gid, dest boson.Address) (result []byte, err error)
- func (s *Service) Snapshot() *model.KadParams
- func (s *Service) Start()
- func (s *Service) StartDiscover()
- func (s *Service) SubscribeGroupMessage(n *rpc.Notifier, sub *rpc.Subscription, gid boson.Address) (err error)
- func (s *Service) SubscribeLogContent(n *rpc.Notifier, sub *rpc.Subscription)
- func (s *Service) SubscribeMulticastMsg(n *rpc.Notifier, sub *rpc.Subscription, gid boson.Address) (err error)
- type WsStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateGID ¶
Types ¶
type GroupInterface ¶
type GroupInterface interface { Multicast(info *pb.MulticastMsg, skip ...boson.Address) error AddGroup(groups []model.ConfigNodeGroup) error RemoveGroup(gid boson.Address, gType model.GType) error Snapshot() *model.KadParams StartDiscover() SubscribeLogContent(n *rpc.Notifier, sub *rpc.Subscription) SubscribeMulticastMsg(n *rpc.Notifier, sub *rpc.Subscription, gid boson.Address) (err error) GetGroupPeers(groupName string) (out *GroupPeers, err error) GetOptimumPeer(groupName string) (peer boson.Address, err error) GetSendStream(ctx context.Context, gid, dest boson.Address) (out SendStreamCh, err error) SendReceive(ctx context.Context, data []byte, gid, dest boson.Address) (result []byte, err error) Send(ctx context.Context, data []byte, gid, dest boson.Address) (err error) }
type GroupMessage ¶
type GroupPeers ¶
type LogContent ¶
type Message ¶
type Message struct { ID uint64 CreateTime int64 GID boson.Address Origin boson.Address Data []byte From boson.Address }
Message multicast message
type NotifyStatus ¶
type NotifyStatus int
const ( NotifyJoinGroup NotifyStatus = iota + 1 NotifyLeaveGroup )
type PeersSubClient ¶
type PeersSubClient struct {
// contains filtered or unexported fields
}
type SendOption ¶
type SendOption int
const ( SendOnly SendOption = iota SendReceive SendStream )
func (SendOption) String ¶
func (s SendOption) String() string
type SendStreamCh ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) GetGroupPeers ¶
func (s *Service) GetGroupPeers(groupName string) (out *GroupPeers, err error)
GetGroupPeers the peers order by EWMA optimal
func (*Service) GetOptimumPeer ¶
func (*Service) GetSendStream ¶
func (*Service) HandshakeIncoming ¶
func (*Service) Protocol ¶
func (s *Service) Protocol() p2p.ProtocolSpec
func (*Service) RemoveGroup ¶
func (*Service) SendReceive ¶
func (*Service) StartDiscover ¶
func (s *Service) StartDiscover()
func (*Service) SubscribeGroupMessage ¶
func (*Service) SubscribeLogContent ¶
func (s *Service) SubscribeLogContent(n *rpc.Notifier, sub *rpc.Subscription)
func (*Service) SubscribeMulticastMsg ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.