notifier

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// BackendHTTPID is a known backend implementation
	BackendHTTPID = "http"

	// BackendKafkaID is a known backend implementation
	BackendKafkaID = "kafka"
)

Variables

View Source
var (

	// RetryBackoffDuration indicates the time to wait between retries.
	RetryBackoffDuration = 10 * time.Minute
)

Functions

This section is empty.

Types

type Notifier

type Notifier struct {
	Storage     *storage.Storage
	Log         *log.Logger
	DownloadURL *url.URL
	StatsIntvl  time.Duration

	// DeletionIntvl indicates the time after which downloaded files must be
	// enqueued for deletion.
	DeletionIntvl time.Duration
	// contains filtered or unexported fields
}

Notifier is the the component responsible for consuming the result of jobs and notifying back the respective users by issuing HTTP requests to their provided callback URLs.

func New

func New(s *storage.Storage, concurrency int, logger *log.Logger, dwnlURL string) (Notifier, error)

New takes the concurrency of the notifier as an argument

func (*Notifier) Notify

func (n *Notifier) Notify(j *job.Job, cbInfo job.Callback) error

Notify posts callback info to job's destination by calling Notify on each backend.

func (*Notifier) PreNotify added in v0.1.0

func (n *Notifier) PreNotify(j *job.Job) (job.Callback, error)

PreNotify runs the necessary actions before calling Notify and returns a callback info

func (*Notifier) Start

func (n *Notifier) Start(closeChan chan struct{}, backendCfg map[string]map[string]interface{})

Start starts the Notifier loop and instruments the worker goroutines that perform the actual notify requests.

Jump to

Keyboard shortcuts

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