Documentation ¶
Index ¶
- type AsyncLoader
- type BlockHooks
- type PeerHandler
- type RequestHooks
- type RequestManager
- func (rm *RequestManager) PauseRequest(requestID graphsync.RequestID) error
- func (rm *RequestManager) ProcessResponses(p peer.ID, responses []gsmsg.GraphSyncResponse, blks []blocks.Block)
- func (rm *RequestManager) SendRequest(ctx context.Context, p peer.ID, root ld.Link, selector ld.Node, ...) (<-chan graphsync.ResponseProgress, <-chan error)
- func (rm *RequestManager) SetDelegate(peerHandler PeerHandler)
- func (rm *RequestManager) Shutdown()
- func (rm *RequestManager) Startup()
- func (rm *RequestManager) UnpauseRequest(requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error
- type ResponseHooks
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncLoader ¶
type AsyncLoader interface { StartRequest(graphsync.RequestID, string) error ProcessResponse(responses map[graphsync.RequestID]metadata.Metadata, blks []blocks.Block) AsyncLoad(requestID graphsync.RequestID, link ld.Link) <-chan types.AsyncLoadResult CompleteResponsesFor(requestID graphsync.RequestID) CleanupRequest(requestID graphsync.RequestID) }
AsyncLoader is an interface for loading links asynchronously, returning results as new responses are processed
type BlockHooks ¶
type BlockHooks interface {
ProcessBlockHooks(p peer.ID, response graphsync.ResponseData, block graphsync.BlockData) hooks.UpdateResult
}
BlockHooks run for each block loaded
type PeerHandler ¶
type PeerHandler interface {
AllocateAndBuildMessage(p peer.ID, blkSize uint64, buildMessageFn func(*gsmsg.Builder), notifees []notifications.Notifee)
}
PeerHandler is an interface that can send requests to peers
type RequestHooks ¶
type RequestHooks interface {
ProcessRequestHooks(p peer.ID, request graphsync.RequestData) hooks.RequestResult
}
RequestHooks run for new requests
type RequestManager ¶
type RequestManager struct {
// contains filtered or unexported fields
}
RequestManager tracks outgoing requests and processes incoming reponses to them.
func New ¶
func New(ctx context.Context, asyncLoader AsyncLoader, requestHooks RequestHooks, responseHooks ResponseHooks, blockHooks BlockHooks, networkErrorListeners *listeners.NetworkErrorListeners, ) *RequestManager
New generates a new request manager from a context, network, and selectorQuerier
func (*RequestManager) PauseRequest ¶
func (rm *RequestManager) PauseRequest(requestID graphsync.RequestID) error
PauseRequest pauses an in progress request (may take 1 or more blocks to process)
func (*RequestManager) ProcessResponses ¶
func (rm *RequestManager) ProcessResponses(p peer.ID, responses []gsmsg.GraphSyncResponse, blks []blocks.Block)
ProcessResponses ingests the given responses from the network and and updates the in progress requests based on those responses.
func (*RequestManager) SendRequest ¶
func (rm *RequestManager) SendRequest(ctx context.Context, p peer.ID, root ld.Link, selector ld.Node, extensions ...graphsync.ExtensionData) (<-chan graphsync.ResponseProgress, <-chan error)
SendRequest initiates a new GraphSync request to the given peer.
func (*RequestManager) SetDelegate ¶
func (rm *RequestManager) SetDelegate(peerHandler PeerHandler)
SetDelegate specifies who will send messages out to the internet.
func (*RequestManager) Shutdown ¶
func (rm *RequestManager) Shutdown()
Shutdown ends processing for the want manager.
func (*RequestManager) Startup ¶
func (rm *RequestManager) Startup()
Startup starts processing for the WantManager.
func (*RequestManager) UnpauseRequest ¶
func (rm *RequestManager) UnpauseRequest(requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error
UnpauseRequest unpauses a request that was paused in a block hook based request ID Can also send extensions with unpause
type ResponseHooks ¶
type ResponseHooks interface {
ProcessResponseHooks(p peer.ID, response graphsync.ResponseData) hooks.UpdateResult
}
ResponseHooks run for new responses