peertaskqueue

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: Apache-2.0, MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.0.4

type Option func(*PeerTaskQueue) Option

Option is a function that configures the peer task queue

func IgnoreFreezing added in v0.0.4

func IgnoreFreezing(ignoreFreezing bool) Option

IgnoreFreezing is an option that can make the task queue ignore freezing and unfreezing

func OnPeerAddedHook added in v0.0.4

func OnPeerAddedHook(onPeerAddedHook func(p peer.ID)) Option

OnPeerAddedHook adds a hook function that gets called whenever the ptq adds a new peer

func OnPeerRemovedHook added in v0.0.4

func OnPeerRemovedHook(onPeerRemovedHook func(p peer.ID)) Option

OnPeerRemovedHook adds a hook function that gets called whenever the ptq adds a new peer

type PeerTaskQueue

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

PeerTaskQueue is a prioritized list of tasks to be executed on peers. The queue puts tasks on in blocks, then alternates between peers (roughly) to execute the block with the highest priority, or otherwise the one added first if priorities are equal.

func New

func New(options ...Option) *PeerTaskQueue

New creates a new PeerTaskQueue

func (*PeerTaskQueue) FullThaw

func (ptq *PeerTaskQueue) FullThaw()

FullThaw completely thaws all peers in the queue so they can execute tasks.

func (*PeerTaskQueue) Options added in v0.0.4

func (ptq *PeerTaskQueue) Options(options ...Option) Option

Options uses configuration functions to configure the peer task queue. It returns an Option that can be called to reverse the changes.

func (*PeerTaskQueue) PopBlock

func (ptq *PeerTaskQueue) PopBlock() *peertask.TaskBlock

PopBlock 'pops' the next block of tasks to be performed. Returns nil if no block exists.

func (*PeerTaskQueue) PushBlock

func (ptq *PeerTaskQueue) PushBlock(to peer.ID, tasks ...peertask.Task)

PushBlock adds a new block of tasks for the given peer to the queue

func (*PeerTaskQueue) Remove

func (ptq *PeerTaskQueue) Remove(identifier peertask.Identifier, p peer.ID)

Remove removes a task from the queue.

func (*PeerTaskQueue) ThawRound

func (ptq *PeerTaskQueue) ThawRound()

ThawRound unthaws peers incrementally, so that those have been frozen the least become unfrozen and able to execute tasks first.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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