notifier

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 2

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

View Source
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.

func (*Impl) SendFail

func (h *Impl) SendFail(j weles.JobID, msg string)

SendFail notifies Controller about failure.

func (*Impl) SendOK

func (h *Impl) SendOK(j weles.JobID)

SendOK notifies Controller about success.

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.

Jump to

Keyboard shortcuts

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