enginemgo

package
v0.0.0-...-ca8e307 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(setter config.Setter) error

Configure is a Configurator function for Redis engine.

func Plugin

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

Plugin returns new memory engine.

Types

type Config

type Config struct {
	URL   string
	Dupl  string
	DB    string
	Redis string
	Mode  string
	Go    int

	JPushMerchantKey    string
	JPushMerchantSecret string
	JPushConsumerKey    string
	JPushConsumerSecret string
	JpushUrl            string
	JpushDeviceUrl      string
	JpushReportUrl      string
}

type MgoEngine

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

func New

func New(n *node.Node, conf *Config) (*MgoEngine, error)

New initializes Memory Engine.

func (*MgoEngine) AddPresence

func (e *MgoEngine) AddPresence(ch string, uid string, info proto.ClientInfo, expire int) error

AddPresence adds client info into presence hub.

func (*MgoEngine) Channels

func (e *MgoEngine) Channels() ([]string, error)

Channels returns all channels node currently subscribed on.

func (*MgoEngine) Forbidden

func (e *MgoEngine) Forbidden(raw.Raw) bool

func (*MgoEngine) History

func (e *MgoEngine) History(ch, appkey, client string, skip, limit int) ([]proto.Message, int, error)

History extracts history from history hub.

func (*MgoEngine) Name

func (e *MgoEngine) Name() string

Name returns a name of engine.

func (*MgoEngine) Permission

func (e *MgoEngine) Permission(eid, permission string) bool

func (*MgoEngine) Presence

func (e *MgoEngine) Presence(ch string) (map[string]proto.ClientInfo, error)

Presence extracts presence info from presence hub.

func (*MgoEngine) PublishAdmin

func (e *MgoEngine) PublishAdmin(message *proto.AdminMessage) <-chan error

PublishAdmin - see Engine interface description.

func (*MgoEngine) PublishControl

func (e *MgoEngine) PublishControl(message *proto.ControlMessage) <-chan error

PublishControl - see Engine interface description.

func (*MgoEngine) PublishJoin

func (e *MgoEngine) PublishJoin(message *proto.JoinMessage, opts *channel.Options) <-chan error

PublishJoin - see Engine interface description.

func (*MgoEngine) PublishLeave

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

PublishLeave - see Engine interface description.

func (*MgoEngine) PublishMessage

func (e *MgoEngine) PublishMessage(message *proto.Message, appkey, users, nusers string, 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 (*MgoEngine) ReadMessage

func (e *MgoEngine) ReadMessage(ch, msgid, uid string) (bool, error)

func (*MgoEngine) RemovePresence

func (e *MgoEngine) RemovePresence(ch, uid, user string) error

RemovePresence removes client info from presence hub.

func (*MgoEngine) Run

func (e *MgoEngine) Run() error

Run runs memory engine - we do not have any logic here as Memory Engine ready to work just after initialization.

func (*MgoEngine) Shutdown

func (e *MgoEngine) Shutdown() error

Shutdown shuts down engine.

func (*MgoEngine) Subscribe

func (e *MgoEngine) Subscribe(ch string) error

Subscribe is noop here.

func (*MgoEngine) Unsubscribe

func (e *MgoEngine) 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