Documentation ¶
Index ¶
- func OversizedMessage(b []byte, size int) bool
- type Channel
- type NoopSpreader
- type Option
- type Options
- type Payload
- type Peer
- func (p *Peer) AddShard(sd Shard) (Spreader, error)
- func (p *Peer) Address() string
- func (p *Peer) Join(ctx context.Context) error
- func (p *Peer) MemberCount() int
- func (p *Peer) OthersNodes() []*memberlist.Node
- func (p *Peer) ReliableMsgHandle(ctx context.Context) error
- func (p *Peer) SendReliable(b []byte)
- func (p *Peer) Start(ctx context.Context) error
- func (p *Peer) Stop(ctx context.Context) error
- type Shard
- type Spreader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OversizedMessage ¶
OversizedMessage indicates whether or not the byte payload should be sent via TCP.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is a channel for communication between shard holding nodes.
func NewChannel ¶
NewChannel creates a new channel for the given shard.
type NoopSpreader ¶
type NoopSpreader struct{}
func (*NoopSpreader) Broadcast ¶
func (n *NoopSpreader) Broadcast([]byte) error
type Option ¶
type Option func(*Options)
func WithConfiguration ¶
func WithConfiguration(cnf *conf.Configuration) Option
type Options ¶
type Options struct { ID string `yaml:"id" json:"id"` Cnf *conf.Configuration `yaml:"-" json:"-"` KnownPeers []string `yaml:"known" json:"known"` Event memberlist.EventDelegate `yaml:"event" json:"event"` Delegate memberlist.Delegate `yaml:"delegate" json:"delegate"` JoinTTL time.Duration `yaml:"joinTTL" json:"joinTTL"` JoinRetry int `yaml:"joinRetry" json:"joinRetry"` }
type Peer ¶
type Peer struct { Options // contains filtered or unexported fields }
Peer is a memberlist Node wrapper
func (*Peer) MemberCount ¶
func (*Peer) OthersNodes ¶
func (p *Peer) OthersNodes() []*memberlist.Node
func (*Peer) SendReliable ¶
type Shard ¶
type Shard interface { // Name returns the name of the shard, which is used to identify the shard. Name() string // MarshalBinary marshals the shard data into a binary to sync other nodes. MarshalBinary() ([]byte, error) // Merge data from remote node MarshalBinary result. The Shard should be able to dedupe the data. Merge(b []byte) error }
Shard is some specified distributed data handler.
Click to show internal directories.
Click to hide internal directories.