multicast

package
v1.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHashToGID

func ConvertHashToGID(h common.Hash) boson.Address

func GenerateGID

func GenerateGID(name string) boson.Address

func RandomPeer

func RandomPeer(peers []boson.Address) boson.Address

func RandomPeersLimit

func RandomPeersLimit(peers []boson.Address, limit int) []boson.Address

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

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 GroupMessage struct {
	SessionID rpc.ID        `json:"sessionID,omitempty"`
	GID       boson.Address `json:"gid"`
	Data      []byte        `json:"data"`
	From      boson.Address `json:"from"`
}

type GroupPeers

type GroupPeers struct {
	Connected []boson.Address `json:"connected"`
	Keep      []boson.Address `json:"keep"`
}

type LogContent

type LogContent struct {
	Event string
	Time  int64 // ms
	Data  Message
}

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 Option

type Option struct {
	Dev bool
}

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 SendStreamCh struct {
	Read     chan []byte
	ReadErr  chan error
	Write    chan []byte
	WriteErr chan error
	Close    chan struct{}
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(self boson.Address, nodeMode aurora.Model, service p2p.Service, streamer p2p.Streamer, kad topology.Driver, route routetab.RouteTab, logger logging.Logger, subPub subscribe.SubPub, o Option) *Service

func (*Service) API

func (s *Service) API() rpc.API

func (*Service) AddGroup

func (s *Service) AddGroup(groups []model.ConfigNodeGroup) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) GetGroupPeers

func (s *Service) GetGroupPeers(groupName string) (out *GroupPeers, err error)

GetGroupPeers the peers order by EWMA optimal

func (*Service) GetOptimumPeer

func (s *Service) GetOptimumPeer(groupName string) (peer boson.Address, err error)

func (*Service) GetSendStream

func (s *Service) GetSendStream(ctx context.Context, gid, dest boson.Address) (out SendStreamCh, err error)

func (*Service) Handshake

func (s *Service) Handshake(ctx context.Context, addr boson.Address) (err error)

func (*Service) HandshakeIncoming

func (s *Service) HandshakeIncoming(ctx context.Context, peer p2p.Peer, stream p2p.Stream) (err error)

func (*Service) Multicast

func (s *Service) Multicast(info *pb.MulticastMsg, skip ...boson.Address) error

func (*Service) Protocol

func (s *Service) Protocol() p2p.ProtocolSpec

func (*Service) RemoveGroup

func (s *Service) RemoveGroup(gid boson.Address, gType model.GType) error

func (*Service) Send

func (s *Service) Send(ctx context.Context, data []byte, gid, dest boson.Address) (err error)

func (*Service) SendReceive

func (s *Service) SendReceive(ctx context.Context, data []byte, gid, dest boson.Address) (result []byte, err error)

func (*Service) Snapshot

func (s *Service) Snapshot() *model.KadParams

func (*Service) Start

func (s *Service) Start()

func (*Service) StartDiscover

func (s *Service) StartDiscover()

func (*Service) SubscribeGroupMessage

func (s *Service) SubscribeGroupMessage(n *rpc.Notifier, sub *rpc.Subscription, gid boson.Address) (err error)

func (*Service) SubscribeLogContent

func (s *Service) SubscribeLogContent(n *rpc.Notifier, sub *rpc.Subscription)

func (*Service) SubscribeMulticastMsg

func (s *Service) SubscribeMulticastMsg(n *rpc.Notifier, sub *rpc.Subscription, gid boson.Address) (err error)

type WsStream

type WsStream struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package pb holds only Protocol Buffer definitions and generated code.
Package pb holds only Protocol Buffer definitions and generated code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL