responsemanager

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0, MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHooks added in v0.1.0

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

BlockHooks is an interface for processing block hooks

type BlockSentListeners added in v0.3.0

type BlockSentListeners interface {
	NotifyBlockSentListeners(p peer.ID, request graphsync.RequestData, block graphsync.BlockData)
}

BlockSentListeners is an interface for notifying listeners that of a block send occuring over the wire

type CancelledListeners added in v0.1.0

type CancelledListeners interface {
	NotifyCancelledListeners(p peer.ID, request graphsync.RequestData)
}

CancelledListeners is an interface for notifying listeners that requestor cancelled

type CompletedListeners added in v0.1.0

type CompletedListeners interface {
	NotifyCompletedListeners(p peer.ID, request graphsync.RequestData, status graphsync.ResponseStatusCode)
}

CompletedListeners is an interface for notifying listeners that responses are complete

type Manager added in v0.10.0

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

Manager providers an interface to the response manager

type NetworkErrorListeners added in v0.3.0

type NetworkErrorListeners interface {
	NotifyNetworkErrorListeners(p peer.ID, request graphsync.RequestData, err error)
}

NetworkErrorListeners is an interface for notifying listeners that an error occurred sending a data on the wire

type QueryQueue

type QueryQueue interface {
	PushTasks(to peer.ID, tasks ...peertask.Task)
	PopTasks(targetMinWork int) (peer.ID, []*peertask.Task, int)
	Remove(topic peertask.Topic, p peer.ID)
	TasksDone(to peer.ID, tasks ...*peertask.Task)
	ThawRound()
}

QueryQueue is an interface that can receive new selector query tasks and prioritize them as needed, and pop them off later

type RequestCloser added in v0.10.2

type RequestCloser interface {
	CloseWithNetworkError(p peer.ID, requestID graphsync.RequestID)
}

RequestCloser can cancel request on a network error

type RequestHooks added in v0.1.0

type RequestHooks interface {
	ProcessRequestHooks(p peer.ID, request graphsync.RequestData) hooks.RequestResult
}

RequestHooks is an interface for processing request hooks

type RequestQueuedHooks added in v0.6.4

type RequestQueuedHooks interface {
	ProcessRequestQueuedHooks(p peer.ID, request graphsync.RequestData)
}

RequestQueuedHooks is an interface for processing request queued hooks

type ResponseAssembler added in v0.6.0

type ResponseAssembler interface {
	DedupKey(p peer.ID, requestID graphsync.RequestID, key string)
	IgnoreBlocks(p peer.ID, requestID graphsync.RequestID, links []ipld.Link)
	SkipFirstBlocks(p peer.ID, requestID graphsync.RequestID, skipCount int64)
	Transaction(p peer.ID, requestID graphsync.RequestID, transaction responseassembler.Transaction) error
}

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

type ResponseManager

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

ResponseManager handles incoming requests from the network, initiates selector traversals, and transmits responses

func New

func New(ctx context.Context,
	linkSystem ipld.LinkSystem,
	responseAssembler ResponseAssembler,
	queryQueue QueryQueue,
	requestQueuedHooks RequestQueuedHooks,
	requestHooks RequestHooks,
	blockHooks BlockHooks,
	updateHooks UpdateHooks,
	completedListeners CompletedListeners,
	cancelledListeners CancelledListeners,
	blockSentListeners BlockSentListeners,
	networkErrorListeners NetworkErrorListeners,
	maxInProcessRequests uint64,
	connManager network.ConnManager,
	maxLinksPerRequest uint64,
) *ResponseManager

New creates a new response manager for responding to requests

func (*ResponseManager) CancelResponse added in v0.1.0

func (rm *ResponseManager) CancelResponse(p peer.ID, requestID graphsync.RequestID) error

CancelResponse cancels an in progress response

func (*ResponseManager) CloseWithNetworkError added in v0.10.2

func (rm *ResponseManager) CloseWithNetworkError(p peer.ID, requestID graphsync.RequestID)

CloseWithNetworkError closes a request due to a network error

func (*ResponseManager) FinishTask added in v0.10.0

func (rm *ResponseManager) FinishTask(task *peertask.Task, err error)

FinishTask marks a task from the task queue as done

func (*ResponseManager) GetUpdates added in v0.10.0

func (rm *ResponseManager) GetUpdates(p peer.ID, requestID graphsync.RequestID, updatesChan chan<- []gsmsg.GraphSyncRequest)

GetUpdates is called to read pending updates for a task and clear them

func (*ResponseManager) PauseResponse added in v0.1.0

func (rm *ResponseManager) PauseResponse(p peer.ID, requestID graphsync.RequestID) error

PauseResponse pauses an in progress response (may take 1 or more blocks to process)

func (*ResponseManager) ProcessRequests

func (rm *ResponseManager) ProcessRequests(ctx context.Context, p peer.ID, requests []gsmsg.GraphSyncRequest)

ProcessRequests processes incoming requests for the given peer

func (*ResponseManager) Shutdown

func (rm *ResponseManager) Shutdown()

Shutdown ends processing for the want manager.

func (*ResponseManager) StartTask added in v0.10.0

func (rm *ResponseManager) StartTask(task *peertask.Task, responseTaskDataChan chan<- ResponseTaskData)

StartTask starts the given task from the peer task queue

func (*ResponseManager) Startup

func (rm *ResponseManager) Startup()

Startup starts processing for the WantManager.

func (*ResponseManager) UnpauseResponse added in v0.1.0

func (rm *ResponseManager) UnpauseResponse(p peer.ID, requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error

UnpauseResponse unpauses a response that was previously paused

type ResponseSignals added in v0.10.0

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

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

type ResponseTaskData added in v0.10.0

type ResponseTaskData struct {
	Empty      bool
	Subscriber *notifications.TopicDataSubscriber
	Ctx        context.Context
	Request    gsmsg.GraphSyncRequest
	Loader     ipld.BlockReadOpener
	Traverser  ipldutil.Traverser
	Signals    ResponseSignals
}

ResponseTaskData returns all information needed to execute a given response

type UpdateHooks added in v0.1.0

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

UpdateHooks is an interface for processing update hooks

Directories

Path Synopsis
Package responseassembler assembles responses that are queued for sending in outgoing messages The response assembler's Transaction method allows a caller to specify response actions that will go into a single libp2p2 message.
Package responseassembler assembles responses that are queued for sending in outgoing messages The response assembler's Transaction method allows a caller to specify response actions that will go into a single libp2p2 message.

Jump to

Keyboard shortcuts

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