workers

package
v0.0.0-...-fd3d7d8 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WWatcher uwe.WorkerName = "watcher"
	WTGBot   uwe.WorkerName = "tg_bot"
	WHub     uwe.WorkerName = "hub"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

type EventBus interface {
	context.Context
	SendMessage(target uwe.WorkerName, data interface{}) error
	MessageBus() <-chan *Message
}

func NewEventBus

func NewEventBus(name uwe.WorkerName, ctx context.Context, toWorker, fromWorker chan *Message) EventBus

type EventHub

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

func NewEventHub

func NewEventHub(defaultChanLen int) *EventHub

func (*EventHub) AddWorker

func (hub *EventHub) AddWorker(name uwe.WorkerName) EventBus

func (*EventHub) Init

func (hub *EventHub) Init() error

func (*EventHub) Run

func (hub *EventHub) Run(ctx uwe.Context) error

type Message

type Message struct {
	UID    int64
	Target uwe.WorkerName
	Sender uwe.WorkerName
	Data   interface{}
}

type TgBot

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

func NewTgBot

func NewTgBot(config config.TGConfig, storage db.StorageI, hubBus EventBus, logger *logrus.Entry) *TgBot

func (*TgBot) Init

func (tg *TgBot) Init() error

func (*TgBot) Run

func (tg *TgBot) Run(ctx uwe.Context) error

type Watcher

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

func NewWatcher

func NewWatcher(config config.Config, storage db.StorageI, hubBus EventBus, logger *logrus.Entry) *Watcher

func (*Watcher) Init

func (w *Watcher) Init() error

func (*Watcher) Run

func (w *Watcher) Run(ctx uwe.Context) error

Jump to

Keyboard shortcuts

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