executor

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0, MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncLoadFn

type AsyncLoadFn func(peer.ID, graphsync.RequestID, ipld.Link, ipld.LinkContext) <-chan types.AsyncLoadResult

AsyncLoadFn is a function which given a request id and an ipld.Link, returns a channel which will eventually return data for the link or an err

type BlockHooks added in v0.10.0

type BlockHooks interface {
	ProcessBlockHooks(p peer.ID, response graphsync.ResponseData, block graphsync.BlockData) hooks.UpdateResult
}

BlockHooks run for each block loaded

type Executor added in v0.10.0

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

Executor handles actually executing graphsync requests and verifying them. It has control of requests when they are in the "running" state, while the manager is in charge when requests are queued or paused

func NewExecutor added in v0.10.0

func NewExecutor(
	manager Manager,
	blockHooks BlockHooks,
	loader AsyncLoadFn) *Executor

NewExecutor returns a new executor

func (*Executor) ExecuteTask added in v0.10.0

func (e *Executor) ExecuteTask(ctx context.Context, pid peer.ID, task *peertask.Task) bool

type Manager added in v0.10.0

type Manager interface {
	SendRequest(peer.ID, gsmsg.GraphSyncRequest)
	GetRequestTask(peer.ID, *peertask.Task, chan RequestTask)
	ReleaseRequestTask(peer.ID, *peertask.Task, error)
}

Manager is an interface the Executor uses to interact with the request manager

type RequestTask added in v0.10.0

type RequestTask struct {
	Ctx            context.Context
	Span           trace.Span
	Request        gsmsg.GraphSyncRequest
	LastResponse   *atomic.Value
	DoNotSendCids  *cid.Set
	PauseMessages  <-chan struct{}
	Traverser      ipldutil.Traverser
	P              peer.ID
	InProgressErr  chan error
	Empty          bool
	InitialRequest bool
}

RequestTask are parameters for a single request execution

Jump to

Keyboard shortcuts

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