Documentation
¶
Overview ¶
Package notifier defines structures and constants used by controller package and provides Notifier interface with implementation for communication between submodules and Controller.
Index ¶
Constants ¶
const BuffSize = 32
BuffSize is the default channel buffer size for channels passing notification messages to Controller.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Impl ¶
type Impl struct {
Notifier
// contains filtered or unexported fields
}
Impl implements Notifier interface
func (*Impl) Listen ¶
func (h *Impl) Listen() <-chan Notification
Listen returns channel which transmits notification about failure or success of processing Job.
type Notification ¶
type Notification struct {
// JobID identifies Job.
weles.JobID
// Ok reports if Job processing stage has ended with success.
OK bool
// Msg contains additional information for the final user.
Msg string
}
Notification describes single notification message for Controller. It is passed to Controller's listening channels.
type Notifier ¶
type Notifier interface {
// Listen returns channel which transmits notification about failure
// or success of processed Job.
Listen() <-chan Notification
// SendFail notifies Controller about failure.
SendFail(j weles.JobID, msg string)
// SendOK notifies Controller about success.
SendOK(j weles.JobID)
}
Notifier defines interface providing channel for notifying Controller.
func NewNotifier ¶
func NewNotifier() Notifier
NewNotifier creates a new Impl structure setting up channel.