Documentation ¶
Index ¶
- func Plugin(n *node.Node, c config.Getter) (engine.Engine, error)
- type Config
- type MemoryEngine
- func (e *MemoryEngine) AddPresence(ch string, uid string, info proto.ClientInfo, expire int) error
- func (e *MemoryEngine) Channels() ([]string, error)
- func (e *MemoryEngine) History(ch string, limit int) ([]proto.Message, error)
- func (e *MemoryEngine) Name() string
- func (e *MemoryEngine) Presence(ch string) (map[string]proto.ClientInfo, error)
- func (e *MemoryEngine) PublishAdmin(message *proto.AdminMessage) <-chan error
- func (e *MemoryEngine) PublishControl(message *proto.ControlMessage) <-chan error
- func (e *MemoryEngine) PublishJoin(message *proto.JoinMessage, opts *proto.ChannelOptions) <-chan error
- func (e *MemoryEngine) PublishLeave(message *proto.LeaveMessage, opts *proto.ChannelOptions) <-chan error
- func (e *MemoryEngine) PublishMessage(message *proto.Message, opts *proto.ChannelOptions) <-chan error
- func (e *MemoryEngine) RemovePresence(ch string, uid string) error
- func (e *MemoryEngine) Run() error
- func (e *MemoryEngine) Shutdown() error
- func (e *MemoryEngine) Subscribe(ch string) error
- func (e *MemoryEngine) Unsubscribe(ch string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemoryEngine ¶
type MemoryEngine struct {
// contains filtered or unexported fields
}
MemoryEngine allows to run Centrifugo without using Redis at all. All data managed inside process memory. With this engine you can only run single Centrifugo node. If you need to scale you should use Redis engine instead.
func New ¶
func New(n *node.Node, conf *Config) (*MemoryEngine, error)
New initializes Memory Engine.
func (*MemoryEngine) AddPresence ¶
func (e *MemoryEngine) AddPresence(ch string, uid string, info proto.ClientInfo, expire int) error
AddPresence adds client info into presence hub.
func (*MemoryEngine) Channels ¶
func (e *MemoryEngine) Channels() ([]string, error)
Channels returns all channels node currently subscribed on.
func (*MemoryEngine) Presence ¶
func (e *MemoryEngine) Presence(ch string) (map[string]proto.ClientInfo, error)
Presence extracts presence info from presence hub.
func (*MemoryEngine) PublishAdmin ¶
func (e *MemoryEngine) PublishAdmin(message *proto.AdminMessage) <-chan error
PublishAdmin - see Engine interface description.
func (*MemoryEngine) PublishControl ¶
func (e *MemoryEngine) PublishControl(message *proto.ControlMessage) <-chan error
PublishControl - see Engine interface description.
func (*MemoryEngine) PublishJoin ¶
func (e *MemoryEngine) PublishJoin(message *proto.JoinMessage, opts *proto.ChannelOptions) <-chan error
PublishJoin - see Engine interface description.
func (*MemoryEngine) PublishLeave ¶
func (e *MemoryEngine) PublishLeave(message *proto.LeaveMessage, opts *proto.ChannelOptions) <-chan error
PublishLeave - see Engine interface description.
func (*MemoryEngine) PublishMessage ¶
func (e *MemoryEngine) PublishMessage(message *proto.Message, opts *proto.ChannelOptions) <-chan error
PublishMessage adds message into history hub and calls node ClientMsg method to handle message. We don't have any PUB/SUB here as Memory Engine is single node only.
func (*MemoryEngine) RemovePresence ¶
func (e *MemoryEngine) RemovePresence(ch string, uid string) error
RemovePresence removes client info from presence hub.
func (*MemoryEngine) Run ¶
func (e *MemoryEngine) Run() error
Run runs memory engine - we do not have any logic here as Memory Engine ready to work just after initialization.
func (*MemoryEngine) Subscribe ¶
func (e *MemoryEngine) Subscribe(ch string) error
Subscribe is noop here.
func (*MemoryEngine) Unsubscribe ¶
func (e *MemoryEngine) Unsubscribe(ch string) error
Unsubscribe node from channel. In case of memory engine its only job is to touch channel history for history lifetime period.