taskqueue

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	ExecuteTask(ctx context.Context, pid peer.ID, task *peertask.Task) bool
}

Executor runs a single task on the queue

type TaskQueue

type TaskQueue interface {
	PushTask(p peer.ID, task peertask.Task)
	TaskDone(p peer.ID, task *peertask.Task)
	Remove(t peertask.Topic, p peer.ID)
	Stats() graphsync.RequestStats
	WithPeerTopics(p peer.ID, f func(*peertracker.PeerTrackerTopics))
}

type WorkerTaskQueue

type WorkerTaskQueue struct {
	*peertaskqueue.PeerTaskQueue
	// contains filtered or unexported fields
}

WorkerTaskQueue is a wrapper around peertaskqueue.PeerTaskQueue that manages running workers that pop tasks and execute them

func NewTaskQueue

func NewTaskQueue(ctx context.Context, ptqopts ...peertaskqueue.Option) *WorkerTaskQueue

NewTaskQueue initializes a new queue

func (*WorkerTaskQueue) PushTask

func (tq *WorkerTaskQueue) PushTask(p peer.ID, task peertask.Task)

PushTask pushes a new task on to the queue

func (*WorkerTaskQueue) Shutdown

func (tq *WorkerTaskQueue) Shutdown()

Shutdown shuts down all running workers

func (*WorkerTaskQueue) Startup

func (tq *WorkerTaskQueue) Startup(workerCount uint64, executor Executor)

Startup runs the given number of task workers with the given executor

func (*WorkerTaskQueue) Stats

func (tq *WorkerTaskQueue) Stats() graphsync.RequestStats

Stats returns statistics about a task queue

func (*WorkerTaskQueue) TaskDone

func (tq *WorkerTaskQueue) TaskDone(p peer.ID, task *peertask.Task)

TaskDone marks a task as completed so further tasks can be executed

func (*WorkerTaskQueue) WaitForNoActiveTasks

func (tq *WorkerTaskQueue) WaitForNoActiveTasks()

func (*WorkerTaskQueue) WithPeerTopics

func (tq *WorkerTaskQueue) WithPeerTopics(p peer.ID, withPeerTopics func(*peertracker.PeerTrackerTopics))

Jump to

Keyboard shortcuts

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