Documentation ¶
Index ¶
- func NewFakeBlockData(size uint64, index int64, onWire bool) graphsync.BlockData
- func NewFakeRequest(id graphsync.RequestID, extensions map[graphsync.ExtensionName]datamodel.Node, ...) graphsync.RequestData
- func NewFakeResponse(id graphsync.RequestID, extensions map[graphsync.ExtensionName]datamodel.Node, ...) graphsync.ResponseData
- type FakeGraphSync
- func (fgs *FakeGraphSync) AssertCancelReceived(ctx context.Context, t *testing.T) graphsync.RequestID
- func (fgs *FakeGraphSync) AssertDoesNotHavePersistenceOption(t *testing.T, name string)
- func (fgs *FakeGraphSync) AssertHasPersistenceOption(t *testing.T, name string) ipld.LinkSystem
- func (fgs *FakeGraphSync) AssertNoCancelReceived(t *testing.T)
- func (fgs *FakeGraphSync) AssertNoPauseReceived(t *testing.T)
- func (fgs *FakeGraphSync) AssertNoRequestReceived(t *testing.T)
- func (fgs *FakeGraphSync) AssertNoResumeReceived(t *testing.T)
- func (fgs *FakeGraphSync) AssertPauseReceived(ctx context.Context, t *testing.T) graphsync.RequestID
- func (fgs *FakeGraphSync) AssertRequestReceived(ctx context.Context, t *testing.T) ReceivedGraphSyncRequest
- func (fgs *FakeGraphSync) AssertResumeReceived(ctx context.Context, t *testing.T) Resume
- func (fgs *FakeGraphSync) Cancel(ctx context.Context, requestID graphsync.RequestID) error
- func (fgs *FakeGraphSync) LeaveRequestsOpen()
- func (fgs *FakeGraphSync) Pause(ctx context.Context, requestID graphsync.RequestID) error
- func (fgs *FakeGraphSync) RegisterBlockSentListener(listener graphsync.OnBlockSentListener) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterCompletedResponseListener(listener graphsync.OnResponseCompletedListener) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterIncomingBlockHook(hook graphsync.OnIncomingBlockHook) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterIncomingRequestHook(hook graphsync.OnIncomingRequestHook) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterIncomingRequestProcessingListener(hook graphsync.OnRequestProcessingListener) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterIncomingResponseHook(hook graphsync.OnIncomingResponseHook) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterNetworkErrorListener(listener graphsync.OnNetworkErrorListener) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterOutgoingBlockHook(hook graphsync.OnOutgoingBlockHook) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterOutgoingRequestHook(hook graphsync.OnOutgoingRequestHook) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterOutgoingRequestProcessingListener(listener graphsync.OnRequestProcessingListener) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterPersistenceOption(name string, lsys ipld.LinkSystem) error
- func (fgs *FakeGraphSync) RegisterReceiverNetworkErrorListener(listener graphsync.OnReceiverNetworkErrorListener) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterRequestUpdatedHook(hook graphsync.OnRequestUpdatedHook) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) RegisterRequestorCancelledListener(listener graphsync.OnRequestorCancelledListener) graphsync.UnregisterHookFunc
- func (fgs *FakeGraphSync) Request(ctx context.Context, p peer.ID, root ipld.Link, selector datamodel.Node, ...) (<-chan graphsync.ResponseProgress, <-chan error)
- func (fgs *FakeGraphSync) SendUpdate(ctx context.Context, id graphsync.RequestID, ...) error
- func (fgs *FakeGraphSync) Stats() graphsync.Stats
- func (fgs *FakeGraphSync) Unpause(ctx context.Context, requestID graphsync.RequestID, ...) error
- func (fgs *FakeGraphSync) UnregisterPersistenceOption(name string) error
- type FakeIncomingBlockHookActions
- type FakeIncomingRequestHookActions
- func (fa *FakeIncomingRequestHookActions) AssertAugmentedContextKey(t *testing.T, key interface{}, value interface{})
- func (fa *FakeIncomingRequestHookActions) AugmentContext(ctxAugFunc func(reqCtx context.Context) context.Context)
- func (fa *FakeIncomingRequestHookActions) DTMessage(t *testing.T) datatransfer.Message
- func (fa *FakeIncomingRequestHookActions) MaxLinks(maxLinks uint64)
- func (fa *FakeIncomingRequestHookActions) PauseResponse()
- func (fa *FakeIncomingRequestHookActions) RefuteAugmentedContextKey(t *testing.T, key interface{})
- func (fa *FakeIncomingRequestHookActions) SendExtensionData(ext graphsync.ExtensionData)
- func (fa *FakeIncomingRequestHookActions) TerminateWithError(err error)
- func (fa *FakeIncomingRequestHookActions) UseLinkTargetNodePrototypeChooser(_ traversal.LinkTargetNodePrototypeChooser)
- func (fa *FakeIncomingRequestHookActions) UsePersistenceOption(name string)
- func (fa *FakeIncomingRequestHookActions) ValidateRequest()
- type FakeIncomingResponseHookActions
- type FakeOutgoingBlockHookActions
- type FakeOutgoingRequestHookActions
- type FakeRequestUpdatedActions
- type ReceivedGraphSyncRequest
- func (gsRequest ReceivedGraphSyncRequest) DTMessage(t *testing.T) datatransfer.Message
- func (gsRequest ReceivedGraphSyncRequest) Response(t *testing.T, incomingRequestMsg datatransfer.Message, ...) graphsync.ResponseData
- func (gsRequest ReceivedGraphSyncRequest) ToRequestData(t *testing.T) graphsync.RequestData
- type Resume
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakeBlockData ¶
NewFakeBlockData returns a fake block that matches the block data interface
func NewFakeRequest ¶
func NewFakeRequest(id graphsync.RequestID, extensions map[graphsync.ExtensionName]datamodel.Node, requestType graphsync.RequestType) graphsync.RequestData
NewFakeRequest returns a fake request that matches the request data interface
func NewFakeResponse ¶
func NewFakeResponse(id graphsync.RequestID, extensions map[graphsync.ExtensionName]datamodel.Node, status graphsync.ResponseStatusCode) graphsync.ResponseData
NewFakeResponse returns a fake response that matches the response data interface
Types ¶
type FakeGraphSync ¶
type FakeGraphSync struct { OutgoingRequestHook graphsync.OnOutgoingRequestHook IncomingBlockHook graphsync.OnIncomingBlockHook OutgoingBlockHook graphsync.OnOutgoingBlockHook IncomingRequestProcessingListener graphsync.OnRequestProcessingListener OutgoingRequestProcessingListener graphsync.OnRequestProcessingListener IncomingRequestHook graphsync.OnIncomingRequestHook CompletedResponseListener graphsync.OnResponseCompletedListener RequestUpdatedHook graphsync.OnRequestUpdatedHook IncomingResponseHook graphsync.OnIncomingResponseHook RequestorCancelledListener graphsync.OnRequestorCancelledListener BlockSentListener graphsync.OnBlockSentListener NetworkErrorListener graphsync.OnNetworkErrorListener ReceiverNetworkErrorListener graphsync.OnReceiverNetworkErrorListener ReturnedCancelError error ReturnedPauseError error ReturnedResumeError error ReturnedSendUpdateError error // contains filtered or unexported fields }
FakeGraphSync implements a GraphExchange but does nothing
func NewFakeGraphSync ¶
func NewFakeGraphSync() *FakeGraphSync
NewFakeGraphSync returns a new fake graphsync implementation
func (*FakeGraphSync) AssertCancelReceived ¶
func (fgs *FakeGraphSync) AssertCancelReceived(ctx context.Context, t *testing.T) graphsync.RequestID
AssertCancelReceived asserts a requests was cancelled before the context closes (and returns said request id)
func (*FakeGraphSync) AssertDoesNotHavePersistenceOption ¶
func (fgs *FakeGraphSync) AssertDoesNotHavePersistenceOption(t *testing.T, name string)
AssertDoesNotHavePersistenceOption verifies that a persistence option is not registered
func (*FakeGraphSync) AssertHasPersistenceOption ¶
func (fgs *FakeGraphSync) AssertHasPersistenceOption(t *testing.T, name string) ipld.LinkSystem
AssertHasPersistenceOption verifies that a persistence option was registered
func (*FakeGraphSync) AssertNoCancelReceived ¶
func (fgs *FakeGraphSync) AssertNoCancelReceived(t *testing.T)
AssertNoCancelReceived asserts that no requests were cancelled by thiss graphsync implementation
func (*FakeGraphSync) AssertNoPauseReceived ¶
func (fgs *FakeGraphSync) AssertNoPauseReceived(t *testing.T)
AssertNoPauseReceived asserts that no pause requests should ahve been received by this graphsync implementation
func (*FakeGraphSync) AssertNoRequestReceived ¶
func (fgs *FakeGraphSync) AssertNoRequestReceived(t *testing.T)
AssertNoRequestReceived asserts that no requests should ahve been received by this graphsync implementation
func (*FakeGraphSync) AssertNoResumeReceived ¶
func (fgs *FakeGraphSync) AssertNoResumeReceived(t *testing.T)
AssertNoResumeReceived asserts that no resume requests should ahve been received by this graphsync implementation
func (*FakeGraphSync) AssertPauseReceived ¶
func (fgs *FakeGraphSync) AssertPauseReceived(ctx context.Context, t *testing.T) graphsync.RequestID
AssertPauseReceived asserts a pause request should be received before the context closes (and returns said request)
func (*FakeGraphSync) AssertRequestReceived ¶
func (fgs *FakeGraphSync) AssertRequestReceived(ctx context.Context, t *testing.T) ReceivedGraphSyncRequest
AssertRequestReceived asserts a request should be received before the context closes (and returns said request)
func (*FakeGraphSync) AssertResumeReceived ¶
AssertResumeReceived asserts a resume request should be received before the context closes (and returns said request)
func (*FakeGraphSync) Cancel ¶
func (fgs *FakeGraphSync) Cancel(ctx context.Context, requestID graphsync.RequestID) error
func (*FakeGraphSync) LeaveRequestsOpen ¶
func (fgs *FakeGraphSync) LeaveRequestsOpen()
func (*FakeGraphSync) Pause ¶
func (fgs *FakeGraphSync) Pause(ctx context.Context, requestID graphsync.RequestID) error
Pause pauses a request based on request ID
func (*FakeGraphSync) RegisterBlockSentListener ¶
func (fgs *FakeGraphSync) RegisterBlockSentListener(listener graphsync.OnBlockSentListener) graphsync.UnregisterHookFunc
RegisterBlockSentListener adds a listener on the responder as blocks go out
func (*FakeGraphSync) RegisterCompletedResponseListener ¶
func (fgs *FakeGraphSync) RegisterCompletedResponseListener(listener graphsync.OnResponseCompletedListener) graphsync.UnregisterHookFunc
RegisterCompletedResponseListener adds a listener on the responder for completed responses
func (*FakeGraphSync) RegisterIncomingBlockHook ¶
func (fgs *FakeGraphSync) RegisterIncomingBlockHook(hook graphsync.OnIncomingBlockHook) graphsync.UnregisterHookFunc
RegisterIncomingBlockHook adds a hook that runs every time a block is received by the requestor
func (*FakeGraphSync) RegisterIncomingRequestHook ¶
func (fgs *FakeGraphSync) RegisterIncomingRequestHook(hook graphsync.OnIncomingRequestHook) graphsync.UnregisterHookFunc
RegisterIncomingRequestHook adds a hook that runs when a request is received
func (*FakeGraphSync) RegisterIncomingRequestProcessingListener ¶
func (fgs *FakeGraphSync) RegisterIncomingRequestProcessingListener(hook graphsync.OnRequestProcessingListener) graphsync.UnregisterHookFunc
RegisterIncomingRequestProcessingListener adds a hook that runs when an incoming GS request begins processing
func (*FakeGraphSync) RegisterIncomingResponseHook ¶
func (fgs *FakeGraphSync) RegisterIncomingResponseHook(hook graphsync.OnIncomingResponseHook) graphsync.UnregisterHookFunc
RegisterIncomingResponseHook adds a hook that runs when a response is received
func (*FakeGraphSync) RegisterNetworkErrorListener ¶
func (fgs *FakeGraphSync) RegisterNetworkErrorListener(listener graphsync.OnNetworkErrorListener) graphsync.UnregisterHookFunc
RegisterNetworkErrorListener adds a listener on the responder as blocks go out
func (*FakeGraphSync) RegisterOutgoingBlockHook ¶
func (fgs *FakeGraphSync) RegisterOutgoingBlockHook(hook graphsync.OnOutgoingBlockHook) graphsync.UnregisterHookFunc
RegisterOutgoingBlockHook adds a hook that runs every time a block is sent from a responder
func (*FakeGraphSync) RegisterOutgoingRequestHook ¶
func (fgs *FakeGraphSync) RegisterOutgoingRequestHook(hook graphsync.OnOutgoingRequestHook) graphsync.UnregisterHookFunc
RegisterOutgoingRequestHook adds a hook that runs immediately prior to sending a new request
func (*FakeGraphSync) RegisterOutgoingRequestProcessingListener ¶
func (fgs *FakeGraphSync) RegisterOutgoingRequestProcessingListener(listener graphsync.OnRequestProcessingListener) graphsync.UnregisterHookFunc
func (*FakeGraphSync) RegisterPersistenceOption ¶
func (fgs *FakeGraphSync) RegisterPersistenceOption(name string, lsys ipld.LinkSystem) error
RegisterPersistenceOption registers an alternate loader/storer combo that can be substituted for the default
func (*FakeGraphSync) RegisterReceiverNetworkErrorListener ¶
func (fgs *FakeGraphSync) RegisterReceiverNetworkErrorListener(listener graphsync.OnReceiverNetworkErrorListener) graphsync.UnregisterHookFunc
RegisterNetworkErrorListener adds a listener on the responder as blocks go out
func (*FakeGraphSync) RegisterRequestUpdatedHook ¶
func (fgs *FakeGraphSync) RegisterRequestUpdatedHook(hook graphsync.OnRequestUpdatedHook) graphsync.UnregisterHookFunc
RegisterRequestUpdatedHook adds a hook that runs every time an update to a request is received
func (*FakeGraphSync) RegisterRequestorCancelledListener ¶
func (fgs *FakeGraphSync) RegisterRequestorCancelledListener(listener graphsync.OnRequestorCancelledListener) graphsync.UnregisterHookFunc
RegisterRequestorCancelledListener adds a listener on the responder for requests cancelled by the requestor
func (*FakeGraphSync) Request ¶
func (fgs *FakeGraphSync) Request(ctx context.Context, p peer.ID, root ipld.Link, selector datamodel.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 (*FakeGraphSync) SendUpdate ¶
func (fgs *FakeGraphSync) SendUpdate(ctx context.Context, id graphsync.RequestID, extensions ...graphsync.ExtensionData) error
func (*FakeGraphSync) Stats ¶
func (fgs *FakeGraphSync) Stats() graphsync.Stats
func (*FakeGraphSync) Unpause ¶
func (fgs *FakeGraphSync) Unpause(ctx context.Context, requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error
Unpause unpauses a request that was paused in a block hook based on request ID
func (*FakeGraphSync) UnregisterPersistenceOption ¶
func (fgs *FakeGraphSync) UnregisterPersistenceOption(name string) error
UnregisterPersistenceOption unregisters an existing loader/storer combo
type FakeIncomingBlockHookActions ¶
type FakeIncomingBlockHookActions struct { TerminationError error SentExtensions []graphsync.ExtensionData Paused bool }
func (*FakeIncomingBlockHookActions) PauseRequest ¶
func (fa *FakeIncomingBlockHookActions) PauseRequest()
func (*FakeIncomingBlockHookActions) TerminateWithError ¶
func (fa *FakeIncomingBlockHookActions) TerminateWithError(err error)
func (*FakeIncomingBlockHookActions) UpdateRequestWithExtensions ¶
func (fa *FakeIncomingBlockHookActions) UpdateRequestWithExtensions(extensions ...graphsync.ExtensionData)
type FakeIncomingRequestHookActions ¶
type FakeIncomingRequestHookActions struct { PersistenceOption string TerminationError error Validated bool SentExtensions []graphsync.ExtensionData Paused bool CtxAugFuncs []func(context.Context) context.Context MaxLinksOption uint64 }
func (*FakeIncomingRequestHookActions) AssertAugmentedContextKey ¶
func (fa *FakeIncomingRequestHookActions) AssertAugmentedContextKey(t *testing.T, key interface{}, value interface{})
func (*FakeIncomingRequestHookActions) AugmentContext ¶
func (fa *FakeIncomingRequestHookActions) AugmentContext(ctxAugFunc func(reqCtx context.Context) context.Context)
func (*FakeIncomingRequestHookActions) DTMessage ¶
func (fa *FakeIncomingRequestHookActions) DTMessage(t *testing.T) datatransfer.Message
func (*FakeIncomingRequestHookActions) MaxLinks ¶
func (fa *FakeIncomingRequestHookActions) MaxLinks(maxLinks uint64)
func (*FakeIncomingRequestHookActions) PauseResponse ¶
func (fa *FakeIncomingRequestHookActions) PauseResponse()
func (*FakeIncomingRequestHookActions) RefuteAugmentedContextKey ¶
func (fa *FakeIncomingRequestHookActions) RefuteAugmentedContextKey(t *testing.T, key interface{})
func (*FakeIncomingRequestHookActions) SendExtensionData ¶
func (fa *FakeIncomingRequestHookActions) SendExtensionData(ext graphsync.ExtensionData)
func (*FakeIncomingRequestHookActions) TerminateWithError ¶
func (fa *FakeIncomingRequestHookActions) TerminateWithError(err error)
func (*FakeIncomingRequestHookActions) UseLinkTargetNodePrototypeChooser ¶
func (fa *FakeIncomingRequestHookActions) UseLinkTargetNodePrototypeChooser(_ traversal.LinkTargetNodePrototypeChooser)
func (*FakeIncomingRequestHookActions) UsePersistenceOption ¶
func (fa *FakeIncomingRequestHookActions) UsePersistenceOption(name string)
func (*FakeIncomingRequestHookActions) ValidateRequest ¶
func (fa *FakeIncomingRequestHookActions) ValidateRequest()
type FakeIncomingResponseHookActions ¶
type FakeIncomingResponseHookActions struct { TerminationError error SentExtensions []graphsync.ExtensionData }
func (*FakeIncomingResponseHookActions) TerminateWithError ¶
func (fa *FakeIncomingResponseHookActions) TerminateWithError(err error)
func (*FakeIncomingResponseHookActions) UpdateRequestWithExtensions ¶
func (fa *FakeIncomingResponseHookActions) UpdateRequestWithExtensions(extensions ...graphsync.ExtensionData)
type FakeOutgoingBlockHookActions ¶
type FakeOutgoingBlockHookActions struct { TerminationError error SentExtensions []graphsync.ExtensionData Paused bool }
func (*FakeOutgoingBlockHookActions) PauseResponse ¶
func (fa *FakeOutgoingBlockHookActions) PauseResponse()
func (*FakeOutgoingBlockHookActions) SendExtensionData ¶
func (fa *FakeOutgoingBlockHookActions) SendExtensionData(extension graphsync.ExtensionData)
func (*FakeOutgoingBlockHookActions) TerminateWithError ¶
func (fa *FakeOutgoingBlockHookActions) TerminateWithError(err error)
type FakeOutgoingRequestHookActions ¶
func (*FakeOutgoingRequestHookActions) MaxLinks ¶
func (fa *FakeOutgoingRequestHookActions) MaxLinks(maxLinks uint64)
func (*FakeOutgoingRequestHookActions) UseLinkTargetNodePrototypeChooser ¶
func (fa *FakeOutgoingRequestHookActions) UseLinkTargetNodePrototypeChooser(_ traversal.LinkTargetNodePrototypeChooser)
func (*FakeOutgoingRequestHookActions) UsePersistenceOption ¶
func (fa *FakeOutgoingRequestHookActions) UsePersistenceOption(name string)
type FakeRequestUpdatedActions ¶
type FakeRequestUpdatedActions struct { TerminationError error SentExtensions []graphsync.ExtensionData Unpaused bool }
func (*FakeRequestUpdatedActions) SendExtensionData ¶
func (fa *FakeRequestUpdatedActions) SendExtensionData(extension graphsync.ExtensionData)
func (*FakeRequestUpdatedActions) TerminateWithError ¶
func (fa *FakeRequestUpdatedActions) TerminateWithError(err error)
func (*FakeRequestUpdatedActions) UnpauseResponse ¶
func (fa *FakeRequestUpdatedActions) UnpauseResponse()
type ReceivedGraphSyncRequest ¶
type ReceivedGraphSyncRequest struct { Ctx context.Context P peer.ID Root ipld.Link Selector datamodel.Node Extensions []graphsync.ExtensionData ResponseChan chan graphsync.ResponseProgress ResponseErrChan chan error }
ReceivedGraphSyncRequest contains data about a received graphsync request
func (ReceivedGraphSyncRequest) DTMessage ¶
func (gsRequest ReceivedGraphSyncRequest) DTMessage(t *testing.T) datatransfer.Message
DTMessage returns the data transfer message among the graphsync extensions sent with this request
func (ReceivedGraphSyncRequest) Response ¶
func (gsRequest ReceivedGraphSyncRequest) Response(t *testing.T, incomingRequestMsg datatransfer.Message, blockMessage datatransfer.Message, code graphsync.ResponseStatusCode) graphsync.ResponseData
func (ReceivedGraphSyncRequest) ToRequestData ¶
func (gsRequest ReceivedGraphSyncRequest) ToRequestData(t *testing.T) graphsync.RequestData