Documentation ¶
Index ¶
- func New(parent context.Context, network gsnet.GraphSyncNetwork, loader ipld.Loader, ...) graphsync.GraphExchange
- type GraphSync
- func (gs *GraphSync) CancelResponse(p peer.ID, requestID graphsync.RequestID) error
- func (gs *GraphSync) PauseRequest(requestID graphsync.RequestID) error
- func (gs *GraphSync) PauseResponse(p peer.ID, requestID graphsync.RequestID) error
- func (gs *GraphSync) RegisterBlockSentListener(listener graphsync.OnBlockSentListener) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterCompletedResponseListener(listener graphsync.OnResponseCompletedListener) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterIncomingBlockHook(hook graphsync.OnIncomingBlockHook) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterIncomingRequestHook(hook graphsync.OnIncomingRequestHook) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterIncomingResponseHook(hook graphsync.OnIncomingResponseHook) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterNetworkErrorListener(listener graphsync.OnNetworkErrorListener) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterOutgoingBlockHook(hook graphsync.OnOutgoingBlockHook) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterOutgoingRequestHook(hook graphsync.OnOutgoingRequestHook) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterPersistenceOption(name string, loader ipld.Loader, storer ipld.Storer) error
- func (gs *GraphSync) RegisterReceiverNetworkErrorListener(listener graphsync.OnReceiverNetworkErrorListener) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterRequestUpdatedHook(hook graphsync.OnRequestUpdatedHook) graphsync.UnregisterHookFunc
- func (gs *GraphSync) RegisterRequestorCancelledListener(listener graphsync.OnRequestorCancelledListener) graphsync.UnregisterHookFunc
- func (gs *GraphSync) Request(ctx context.Context, p peer.ID, root ipld.Link, selector ipld.Node, ...) (<-chan graphsync.ResponseProgress, <-chan error)
- func (gs *GraphSync) UnpauseRequest(requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error
- func (gs *GraphSync) UnpauseResponse(p peer.ID, requestID graphsync.RequestID, ...) error
- func (gs *GraphSync) UnregisterPersistenceOption(name string) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GraphSync ¶
type GraphSync struct {
// contains filtered or unexported fields
}
GraphSync is an instance of a GraphSync exchange that implements the graphsync protocol.
func (*GraphSync) CancelResponse ¶ added in v0.1.0
CancelResponse cancels an in progress response
func (*GraphSync) PauseRequest ¶ added in v0.1.0
PauseRequest pauses an in progress request (may take 1 or more blocks to process)
func (*GraphSync) PauseResponse ¶ added in v0.1.0
PauseResponse pauses an in progress response (may take 1 or more blocks to process)
func (*GraphSync) RegisterBlockSentListener ¶ added in v0.3.0
func (gs *GraphSync) RegisterBlockSentListener(listener graphsync.OnBlockSentListener) graphsync.UnregisterHookFunc
RegisterBlockSentListener adds a listener for when blocks are actually sent over the wire
func (*GraphSync) RegisterCompletedResponseListener ¶ added in v0.1.0
func (gs *GraphSync) RegisterCompletedResponseListener(listener graphsync.OnResponseCompletedListener) graphsync.UnregisterHookFunc
RegisterCompletedResponseListener adds a listener on the responder for completed responses
func (*GraphSync) RegisterIncomingBlockHook ¶ added in v0.1.0
func (gs *GraphSync) RegisterIncomingBlockHook(hook graphsync.OnIncomingBlockHook) graphsync.UnregisterHookFunc
RegisterIncomingBlockHook adds a hook that runs when a block is received and validated (put in block store)
func (*GraphSync) RegisterIncomingRequestHook ¶ added in v0.1.0
func (gs *GraphSync) RegisterIncomingRequestHook(hook graphsync.OnIncomingRequestHook) graphsync.UnregisterHookFunc
RegisterIncomingRequestHook adds a hook that runs when a request is received If overrideDefaultValidation is set to true, then if the hook does not error, it is considered to have "validated" the request -- and that validation supersedes the normal validation of requests Graphsync does (i.e. all selectors can be accepted)
func (*GraphSync) RegisterIncomingResponseHook ¶ added in v0.1.0
func (gs *GraphSync) RegisterIncomingResponseHook(hook graphsync.OnIncomingResponseHook) graphsync.UnregisterHookFunc
RegisterIncomingResponseHook adds a hook that runs when a response is received
func (*GraphSync) RegisterNetworkErrorListener ¶ added in v0.3.0
func (gs *GraphSync) RegisterNetworkErrorListener(listener graphsync.OnNetworkErrorListener) graphsync.UnregisterHookFunc
RegisterNetworkErrorListener adds a listener for when errors occur sending data over the wire
func (*GraphSync) RegisterOutgoingBlockHook ¶ added in v0.1.0
func (gs *GraphSync) RegisterOutgoingBlockHook(hook graphsync.OnOutgoingBlockHook) graphsync.UnregisterHookFunc
RegisterOutgoingBlockHook registers a hook that runs after each block is sent in a response
func (*GraphSync) RegisterOutgoingRequestHook ¶ added in v0.1.0
func (gs *GraphSync) RegisterOutgoingRequestHook(hook graphsync.OnOutgoingRequestHook) graphsync.UnregisterHookFunc
RegisterOutgoingRequestHook adds a hook that runs immediately prior to sending a new request
func (*GraphSync) RegisterPersistenceOption ¶ added in v0.1.0
func (gs *GraphSync) RegisterPersistenceOption(name string, loader ipld.Loader, storer ipld.Storer) error
RegisterPersistenceOption registers an alternate loader/storer combo that can be substituted for the default
func (*GraphSync) RegisterReceiverNetworkErrorListener ¶ added in v0.6.0
func (gs *GraphSync) RegisterReceiverNetworkErrorListener(listener graphsync.OnReceiverNetworkErrorListener) graphsync.UnregisterHookFunc
RegisterReceiverNetworkErrorListener adds a listener for when errors occur receiving data over the wire
func (*GraphSync) RegisterRequestUpdatedHook ¶ added in v0.1.0
func (gs *GraphSync) RegisterRequestUpdatedHook(hook graphsync.OnRequestUpdatedHook) graphsync.UnregisterHookFunc
RegisterRequestUpdatedHook registers a hook that runs when an update to a request is received
func (*GraphSync) RegisterRequestorCancelledListener ¶ added in v0.1.0
func (gs *GraphSync) RegisterRequestorCancelledListener(listener graphsync.OnRequestorCancelledListener) graphsync.UnregisterHookFunc
RegisterRequestorCancelledListener adds a listener on the responder for responses cancelled by the requestor
func (*GraphSync) Request ¶
func (gs *GraphSync) Request(ctx context.Context, p peer.ID, root ipld.Link, selector ipld.Node, extensions ...graphsync.ExtensionData) (<-chan graphsync.ResponseProgress, <-chan error)
Request initiates a new GraphSync request to the given peer using the given selector spec.
func (*GraphSync) UnpauseRequest ¶ added in v0.1.0
func (gs *GraphSync) 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
func (*GraphSync) UnpauseResponse ¶ added in v0.1.0
func (gs *GraphSync) UnpauseResponse(p peer.ID, requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error
UnpauseResponse unpauses a response that was paused in a block hook based on peer ID and request ID
func (*GraphSync) UnregisterPersistenceOption ¶ added in v0.1.0
UnregisterPersistenceOption unregisters an alternate loader/storer combo
type Option ¶ added in v0.1.0
type Option func(*graphsyncConfigOptions)
Option defines the functional option type that can be used to configure graphsync instances
func MaxInProgressRequests ¶ added in v0.5.1
MaxInProgressRequests changes the maximum number of graphsync requests that are processed in parallel (default 6)
func MaxMemoryPerPeerResponder ¶ added in v0.4.0
MaxMemoryPerPeerResponder defines the maximum amount of memory a peer may consume queueing up messages for a response
func MaxMemoryResponder ¶ added in v0.4.0
MaxMemoryResponder defines the maximum amount of memory the responder may consume queueing up messages for a response in total
func RejectAllRequestsByDefault ¶ added in v0.1.0
func RejectAllRequestsByDefault() Option
RejectAllRequestsByDefault means that without hooks registered that perform their own request validation, all requests are rejected