queue

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrSourceAlreadyRegistered   = bg.Error("source already registered")
	ErrListenerAlreadyRegistered = bg.Error("listener already registered")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(queueLimit int) *Queue

NewQueue instantiates a new Queue struct

func (*Queue) Pop

func (q *Queue) Pop() *proto.Frame

Pop returns the first item in the queue and deletes it from the queue

func (*Queue) Push

func (q *Queue) Push(v *proto.Frame)

Push adds a new item to the back of the queue

func (*Queue) Subscribe

func (q *Queue) Subscribe(name string) (chan int, func(), error)

Subscribe returns a channel which will have signals sent when a new item is pushed as well as an unsub function

type QueueListener

type QueueListener struct {
	IsConnected bool
	Signal      chan int
}

type QueueManager

type QueueManager struct {
	Logger *zerolog.Logger

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewQueueManager

func NewQueueManager(logger *zerolog.Logger) *QueueManager

NewQueueManager initializes a new QueueManager instance

func (*QueueManager) RegisterListener

func (m *QueueManager) RegisterListener(source, name string) (*Queue, func(), error)

RegisterListener creates a new queue, registers a new listener in the list of outgoing queues, and returns that queue

func (*QueueManager) RegisterSource

func (m *QueueManager) RegisterSource(name string) (*Queue, func(), error)

RegisterSource adds a new entry in the incomingQueues map and returns a newly created queue as well as deregistering function

func (*QueueManager) Shutdown

func (m *QueueManager) Shutdown()

Shutdown shuts down all the queue listener go routines, closes all quit channels

Jump to

Keyboard shortcuts

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