Documentation ¶
Index ¶
- func ConvertGIDs(GIDs [][]byte) []boson.Address
- 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) HandshakeAll()
- func (s *Service) HandshakeAllKept(gs []*Group, connected bool)
- func (s *Service) HandshakeAllPeers(ps *pslice.PSlice)
- 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 ConvertGIDs ¶ added in v1.3.6
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 ¶ added in v1.3.0
type GroupPeers ¶ added in v1.3.0
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 ¶ added in v1.3.0
type PeersSubClient struct {
// contains filtered or unexported fields
}
type SendOption ¶ added in v1.3.0
type SendOption int
const ( SendOnly SendOption = iota SendReceive SendStream )
func (SendOption) String ¶ added in v1.3.2
func (s SendOption) String() string
type SendStreamCh ¶ added in v1.3.0
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AddGroup ¶ added in v1.3.0
func (s *Service) AddGroup(groups []model.ConfigNodeGroup) error
func (*Service) GetGroupPeers ¶ added in v1.3.0
func (s *Service) GetGroupPeers(groupName string) (out *GroupPeers, err error)
GetGroupPeers the peers order by EWMA optimal
func (*Service) GetOptimumPeer ¶ added in v1.3.2
func (*Service) GetSendStream ¶ added in v1.3.0
func (*Service) HandshakeAll ¶ added in v1.3.6
func (s *Service) HandshakeAll()
func (*Service) HandshakeAllKept ¶ added in v1.3.6
func (*Service) HandshakeAllPeers ¶ added in v1.3.6
func (*Service) HandshakeIncoming ¶
func (*Service) Protocol ¶
func (s *Service) Protocol() p2p.ProtocolSpec
func (*Service) RemoveGroup ¶ added in v1.3.0
func (*Service) SendReceive ¶ added in v1.3.0
func (*Service) StartDiscover ¶
func (s *Service) StartDiscover()
func (*Service) SubscribeGroupMessage ¶ added in v1.3.0
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.