push

package
v0.0.0-...-4fdfd55 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessage

func NewMessage(ctx context.Context, rpc string, data interface{}) (*protocol.Message, error)

Types

type Config

type Config struct {
	FanOut       bool
	NatsEndpoint string
}

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

Validate returns an error if the config is invalid.

type EngagementUpdate

type EngagementUpdate struct {
	CardID     globalid.ID       `json:"cardID"`
	Engagement *model.Engagement `json:"engagement"`
}

type FanOut

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

func NewFanOut

func NewFanOut(bus *nats.EncodedConn, conns connections, log log.Logger) (*FanOut, error)

func (*FanOut) ListenToAll

func (fa *FanOut) ListenToAll(m *protocol.Message)

func (*FanOut) ListenToUserMessage

func (fa *FanOut) ListenToUserMessage(m *NatsMessage)

func (*FanOut) PublishToAll

func (fa *FanOut) PublishToAll(m *protocol.Message) error

func (*FanOut) PublishToUser

func (fa *FanOut) PublishToUser(userID globalid.ID, m *protocol.Message) error

type NatsMessage

type NatsMessage struct {
	Message *protocol.Message `json:"message"`
	UserID  globalid.ID       `json:"userID"`
}

type Pusher

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

func NewPusher

func NewPusher(conns connections, s store, c *Config, l log.Logger) (*Pusher, error)

func (*Pusher) DeleteCard

func (p *Pusher) DeleteCard(ctx context.Context, session *model.Session, id globalid.ID) error

func (*Pusher) NewCard

func (p *Pusher) NewCard(ctx context.Context, session *model.Session, card *model.CardResponse) error

func (*Pusher) NewNotification

func (p *Pusher) NewNotification(ctx context.Context, session *model.Session, notif *model.ExportedNotification) error

func (*Pusher) UpdateCard

func (p *Pusher) UpdateCard(ctx context.Context, session *model.Session, card *model.CardResponse) error

func (*Pusher) UpdateCoinBalance

func (p *Pusher) UpdateCoinBalance(ctx context.Context, userID globalid.ID, newBalances *model.CoinBalances) error

func (*Pusher) UpdateEngagement

func (p *Pusher) UpdateEngagement(ctx context.Context, session *model.Session, cardID globalid.ID) error

func (*Pusher) UpdateNotification

func (p *Pusher) UpdateNotification(ctx context.Context, session *model.Session, notif *model.ExportedNotification) error

func (*Pusher) UpdateUser

func (p *Pusher) UpdateUser(ctx context.Context, session *model.Session, user *model.ExportedUser) error

Jump to

Keyboard shortcuts

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