event

package
v0.0.0-...-edfd98a Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	ConcurrentWatch(queue *Queue) chan error
	Auth() error
}

type Event

type Event interface {
	Kind() EventKind
	Type() ImplementationType
}

type EventImplementations

type EventImplementations []Event

type EventKind

type EventKind string
const (

	// NewFile is whenever a new file is created in a given directory
	NewFile EventKind = "NewFile"
)

type ImplementationType

type ImplementationType string

type Queue

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

func NewQueue

func NewQueue(brokers []Broker) *Queue

NewQueue creates a new event queue. Use this to initialise the queue.

func (*Queue) AddEvent

func (q *Queue) AddEvent(event Event)

AddEvent is a thread safe way to add an event to the queue. Use this function to add an event to the queue, it will processed FIFO

func (*Queue) ConcurrentStart

func (q *Queue) ConcurrentStart() chan error

ConcurrentStart will start the queue process and begin watching for events. Use this function to start the queue, and authenticate each of the defined brokers.

func (*Queue) PopFromQueue

func (q *Queue) PopFromQueue() (Event, error)

PopFromQueue is a thread safe way to pop the oldest event from the queue The queue behaves as a FIFO queue, and right now that cannot be configured. Use this function to take the oldest message out of the queue to operate on it. PopFromQueue will return an error if there is nothing in the queue.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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