queryexecutor

package
v0.13.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ErrCancelledByCommand = errorString("response cancelled by responder")
View Source
const ErrFirstBlockLoad = errorString("Unable to load first block")

ErrFirstBlockLoad indicates the traversal was unable to load the very first block in the traversal

View Source
const ErrNetworkError = errorString("network error")

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHooks

type BlockHooks interface {
	ProcessBlockHooks(p peer.ID, request graphsync.RequestData, blockData graphsync.BlockData) hooks.BlockResult
}

BlockHooks is an interface for processing block hooks

type Manager

type Manager interface {
	StartTask(task *peertask.Task, p peer.ID, responseTaskChan chan<- ResponseTask)
	GetUpdates(requestID graphsync.RequestID, updatesChan chan<- []gsmsg.GraphSyncRequest)
	FinishTask(task *peertask.Task, p peer.ID, err error)
}

Manager providers an interface to the response manager

type QueryExecutor

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

QueryExecutor is responsible for performing individual requests by executing their traversals

func New

func New(ctx context.Context,
	manager Manager,
	blockHooks BlockHooks,
	updateHooks UpdateHooks,
) *QueryExecutor

New creates a new QueryExecutor

func (*QueryExecutor) ExecuteTask

func (qe *QueryExecutor) ExecuteTask(_ context.Context, pid peer.ID, task *peertask.Task) bool

ExecuteTask takes a single task and executes its traversal it describes. For each block, it checks for signals on the task's ResponseSignals, updates on the QueryExecutor's UpdateHooks, and uses the ResponseAssembler to build and send a response, while also triggering any of the QueryExecutor's BlockHooks. Traversal continues until complete, or a signal or hook suggests we should stop or pause.

type ResponseSignals

type ResponseSignals struct {
	PauseSignal  chan struct{}
	UpdateSignal chan struct{}
	ErrSignal    chan error
}

ResponseSignals are message channels to communicate between the manager and the QueryExecutor

type ResponseStream

type ResponseStream interface {
	ClearRequest()
	Transaction(transaction responseassembler.Transaction) error
}

ResponseStream is an interface that returns sender interfaces for peer responses.

type ResponseTask

type ResponseTask struct {
	Empty          bool
	Ctx            context.Context
	Span           trace.Span
	Request        gsmsg.GraphSyncRequest
	Loader         ipld.BlockReadOpener
	Traverser      ipldutil.Traverser
	Signals        ResponseSignals
	ResponseStream ResponseStream
}

ResponseTask returns all information needed to execute a given response

type UpdateHooks

type UpdateHooks interface {
	ProcessUpdateHooks(p peer.ID, request graphsync.RequestData, update graphsync.RequestData) hooks.UpdateResult
}

UpdateHooks is an interface for processing update hooks

Jump to

Keyboard shortcuts

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