enginememory

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Plugin

func Plugin(n *node.Node, c config.Getter) (engine.Engine, error)

Plugin returns new memory engine.

Types

type Config

type Config struct{}

Config is a memory engine congig struct.

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) History

func (e *MemoryEngine) History(ch string, limit int) ([]proto.Message, error)

History extracts history from history hub.

func (*MemoryEngine) Name

func (e *MemoryEngine) Name() string

Name returns a name of engine.

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 *channel.Options) <-chan error

PublishJoin - see Engine interface description.

func (*MemoryEngine) PublishLeave

func (e *MemoryEngine) PublishLeave(message *proto.LeaveMessage, opts *channel.Options) <-chan error

PublishLeave - see Engine interface description.

func (*MemoryEngine) PublishMessage

func (e *MemoryEngine) PublishMessage(message *proto.Message, opts *channel.Options) <-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) Shutdown

func (e *MemoryEngine) Shutdown() error

Shutdown shuts down engine.

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.

Jump to

Keyboard shortcuts

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