Documentation
¶
Index ¶
- Variables
- type Bucket
- func (b *Bucket) Broadcast(p *protocol.Proto)
- func (b *Bucket) Channel(key string) (ch *Channel)
- func (b *Bucket) ChannelCount() int
- func (b *Bucket) ChannelsCount() (res []string)
- func (b *Bucket) Del(dch *Channel)
- func (b *Bucket) DelGroup(group *Group)
- func (b *Bucket) Group(gid string) (group *Group)
- func (b *Bucket) GroupCast(gid string, p *protocol.Proto)
- func (b *Bucket) GroupCount() int
- func (b *Bucket) GroupsCount() (res map[string]int32)
- func (b *Bucket) Put(ch *Channel) (err error)
- func (b *Bucket) PutGroup(gid string) (group *Group, err error)
- type BucketConfig
- type Channel
- func (c *Channel) Close()
- func (c *Channel) DelNode(id string)
- func (c *Channel) GetGroups() []string
- func (c *Channel) GetIP() string
- func (c *Channel) GetKey() string
- func (c *Channel) GetNode(id string) *Node
- func (c *Channel) GetPort() string
- func (c *Channel) GetSeq() int32
- func (c *Channel) Groups() map[string]*Node
- func (c *Channel) Push(p *protocol.Proto) (err error)
- func (c *Channel) Ready() *protocol.Proto
- func (c *Channel) Resend()
- func (c *Channel) SetNode(id string, node *Node)
- func (c *Channel) Signal()
- type Group
- type GroupCastReq
- type Node
- type Resend
- type Ring
- type Round
- type RoundOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTaskJobCantInit = errors.New("task job can not init")
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is a channel holder.
func NewBucket ¶
func NewBucket(cfg *BucketConfig) (b *Bucket)
NewBucket new a bucket struct. store the key with im channel.
func (*Bucket) ChannelCount ¶
ChannelCount channel count in the bucket
func (*Bucket) ChannelsCount ¶
func (*Bucket) GroupsCount ¶
GroupsCount get all group id where online number > 0.
type BucketConfig ¶
type BucketConfig struct {
Size int `json:",default=32"`
Channel int `json:",default=1024"`
Groups int `json:",default=1024"`
RoutineAmount uint64 `json:",default=32"`
RoutineSize int `json:",default=1024"`
}
BucketConfig is bucket config.
type Channel ¶
type Channel struct {
CliProto Ring
Writer bufio.Writer
Reader bufio.Reader
Seq int32
Key string
IP string
Port string
// contains filtered or unexported fields
}
Channel used by message pusher send msg to write goroutine.
func (*Channel) Resend ¶
func (c *Channel) Resend()
Resend send signal to the channel, protocol resend.
type Group ¶
type Group struct {
ID string
Online int32 // dirty read is ok
AllOnline int32
// contains filtered or unexported fields
}
Group is a group and store channel group info.
type GroupCastReq ¶
type GroupCastReq struct {
// contains filtered or unexported fields
}
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring ring proto buffer.
Click to show internal directories.
Click to hide internal directories.