feeds

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	Settings *storage.SyncedSettings
	// contains filtered or unexported fields
}

Feed provides access to a stream of tasks that are ready to be delivered.

func New

func New(
	queue string,
	db *storage.PebbleClient,
	raft *raft.Raft,
) (*Feed, error)

func (*Feed) Close

func (f *Feed) Close() error

Close stops the feed from listening to ready tasks.

This method must be called once after the feed is no longer needed.

func (*Feed) Tasks

func (f *Feed) Tasks() q.TaskStream

type Lease

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

Lease is a handle on a task feed.

Release should be called as soon as the lease is no longer needed.

func (*Lease) Feed

func (l *Lease) Feed() *Feed

Feed returns the feed being leased.

The feed object must not be used after Release is called.

func (*Lease) Release

func (l *Lease) Release()

type Manager

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

Manager ensures that only one feed is active per requested queue.

func NewManager

func NewManager(db *storage.PebbleClient, raft *raft.Raft) *Manager

func (*Manager) Close

func (qm *Manager) Close() error

Close releases all resources for managed feeds.

func (*Manager) Lease

func (qm *Manager) Lease(queue string) (*Lease, error)

Lease grants access to the feed for the requested queue.

The Tasks method should be preferred in most cases.

func (*Manager) Tasks

func (qm *Manager) Tasks(queue string, handle func(tasks q.TaskStream) error) error

Tasks provides access to ready tasks from a queue.

This method automatically manages a lease on the feed.

type TaskBroker

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

TaskBroker manages the read and ack streams of a task feed.

func NewTaskBroker

func NewTaskBroker(
	stream proto.Queue_PullServer,
	fm *Manager,
	raft *raft.Raft,
) *TaskBroker

func (*TaskBroker) Close

func (tb *TaskBroker) Close() error

func (*TaskBroker) Start

func (tb *TaskBroker) Start() error

Directories

Path Synopsis
q

Jump to

Keyboard shortcuts

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