Documentation ¶
Index ¶
Constants ¶
const ErrCancelledByCommand = errorString("response cancelled by responder")
const ErrFirstBlockLoad = errorString("Unable to load first block")
ErrFirstBlockLoad indicates the traversal was unable to load the very first block in the traversal
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 ¶
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 ¶ added in v0.11.4
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