tasks

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ping = iota + 1
	AskPeers
	MineMicro
	PersistComplete
)

Variables

This section is empty.

Functions

func SendAsyncTask added in v0.8.1

func SendAsyncTask(output chan AsyncTask, task AsyncTask)

SendAsyncTask sends task into channel with overflow check.

Types

type AskPeersTask

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

func NewAskPeersTask

func NewAskPeersTask(d time.Duration) AskPeersTask

func (AskPeersTask) Run

func (a AskPeersTask) Run(ctx context.Context, output chan AsyncTask) error

func (AskPeersTask) Type

func (a AskPeersTask) Type() int

type AsyncTask

type AsyncTask struct {
	TaskType int
	Data     interface{}
}

type MineMicroTask

type MineMicroTask struct {
	MineMicroTaskData MineMicroTaskData
	// contains filtered or unexported fields
}

func NewMineMicroTask

func NewMineMicroTask(timeout time.Duration, block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) MineMicroTask

func (MineMicroTask) Run

func (a MineMicroTask) Run(ctx context.Context, output chan AsyncTask) error

func (MineMicroTask) Type

func (MineMicroTask) Type() int

type MineMicroTaskData

type MineMicroTaskData struct {
	Block   *proto.Block
	Limits  proto.MiningLimits
	KeyPair proto.KeyPair
	Vrf     []byte
}

type PingTask

type PingTask struct {
}

func (PingTask) Run

func (PingTask) Run(ctx context.Context, output chan AsyncTask) error

func (PingTask) Type

func (PingTask) Type() int

type Task

type Task interface {
	Run(ctx context.Context, output chan AsyncTask) error
	Type() int
}

func NewFuncTask

func NewFuncTask(f func(ctx context.Context, output chan AsyncTask) error, taskType int) Task

func NewPingTask

func NewPingTask() Task

func Tasks

func Tasks(tasks ...Task) []Task

type TaskType

type TaskType int

Jump to

Keyboard shortcuts

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