Documentation ¶
Index ¶
- func GenerateBlocksOfSize(n int, size int64) []blocks.Block
- func GenerateCid() cid.Cid
- func GenerateCids(n int) []cid.Cid
- func GeneratePeers(t *testing.T, n int) []peer.ID
- func GenerateRetrievalCandidates(t *testing.T, n int) []types.RetrievalCandidate
- func GenerateRetrievalIDs(t *testing.T, n int) []types.RetrievalID
- func GenerateRetrievalRequests(t *testing.T, n int) []types.RetrievalRequest
- func RandomBytes(n int64) []byte
- func VerifyCollectedEvent(t *testing.T, actual types.RetrievalEvent, expected types.RetrievalEvent)
- func VerifyCollectedEventTimings(t *testing.T, events []types.RetrievalEvent)
- func VerifyContainsCollectedEvent(t *testing.T, actualList []types.RetrievalEvent, expected types.RetrievalEvent)
- type AsyncCollectingEventsListener
- type ClientRetrievalRequest
- type CollectingEventsListener
- type DelayedClientReturn
- type DelayedConnectReturn
- type DiscoveredCandidate
- type ExpectedActionsAtTime
- type MockCandidateFinder
- func (me *MockCandidateFinder) FindCandidates(ctx context.Context, cid cid.Cid) ([]types.RetrievalCandidate, error)
- func (me *MockCandidateFinder) FindCandidatesAsync(ctx context.Context, c cid.Cid, cb func(types.RetrievalCandidate)) error
- func (me *MockCandidateFinder) VerifyCandidatesDiscovered(ctx context.Context, t *testing.T, ...)
- type MockClient
- func (mc *MockClient) Connect(ctx context.Context, minerPeer peer.AddrInfo) error
- func (mc *MockClient) GetConnectReturns() map[string]DelayedConnectReturn
- func (mc *MockClient) GetReceivedLinkSystems() []ipld.LinkSystem
- func (mc *MockClient) GetRetrievalReturns() map[string]DelayedClientReturn
- func (mc *MockClient) RetrieveFromPeer(ctx context.Context, linkSystem ipld.LinkSystem, peerID peer.ID, ...) (*types.RetrievalStats, error)
- func (mc *MockClient) SetConnectReturns(connectReturns map[string]DelayedConnectReturn)
- func (mc *MockClient) SetRetrievalReturns(retrievalReturns map[string]DelayedClientReturn)
- func (mc *MockClient) VerifyConnectionsReceived(ctx context.Context, t *testing.T, expectedConnections []peer.ID)
- func (mc *MockClient) VerifyReceivedRetrievalFrom(ctx context.Context, t *testing.T, p peer.ID) ClientRetrievalRequest
- func (mc *MockClient) VerifyRetrievalsReceived(ctx context.Context, t *testing.T, expectedRetrievals []peer.ID)
- type RetrievalVerifier
- type RunRetrieval
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateBlocksOfSize ¶
GenerateBlocksOfSize generates a series of blocks of the given byte size
func GeneratePeers ¶
GeneratePeers creates n peer ids.
func GenerateRetrievalCandidates ¶
func GenerateRetrievalCandidates(t *testing.T, n int) []types.RetrievalCandidate
GenerateRetrievalCandidates produces n retrieval candidates
func GenerateRetrievalIDs ¶
func GenerateRetrievalIDs(t *testing.T, n int) []types.RetrievalID
func GenerateRetrievalRequests ¶ added in v0.6.0
func GenerateRetrievalRequests(t *testing.T, n int) []types.RetrievalRequest
GenerateRetrievalRequests produces retrieval requests
func RandomBytes ¶
RandomBytes returns a byte array of the given size with random values.
func VerifyCollectedEvent ¶
func VerifyCollectedEvent(t *testing.T, actual types.RetrievalEvent, expected types.RetrievalEvent)
func VerifyCollectedEventTimings ¶
func VerifyCollectedEventTimings(t *testing.T, events []types.RetrievalEvent)
func VerifyContainsCollectedEvent ¶
func VerifyContainsCollectedEvent(t *testing.T, actualList []types.RetrievalEvent, expected types.RetrievalEvent)
Types ¶
type AsyncCollectingEventsListener ¶ added in v0.7.0
type AsyncCollectingEventsListener struct {
// contains filtered or unexported fields
}
func NewAsyncCollectingEventsListener ¶ added in v0.7.0
func NewAsyncCollectingEventsListener(ctx context.Context) *AsyncCollectingEventsListener
func (*AsyncCollectingEventsListener) Collect ¶ added in v0.7.0
func (ev *AsyncCollectingEventsListener) Collect(evt types.RetrievalEvent)
func (*AsyncCollectingEventsListener) VerifyNextEvents ¶ added in v0.7.0
func (ev *AsyncCollectingEventsListener) VerifyNextEvents(t *testing.T, expectedEvents []types.RetrievalEvent)
type ClientRetrievalRequest ¶ added in v0.7.0
type ClientRetrievalRequest struct { Peer peer.ID Proposal *retrievaltypes.DealProposal Selector ipld.Node }
type CollectingEventsListener ¶
type CollectingEventsListener struct { CollectedEvents []types.RetrievalEvent // contains filtered or unexported fields }
func NewCollectingEventsListener ¶
func NewCollectingEventsListener() *CollectingEventsListener
func (*CollectingEventsListener) Collect ¶
func (el *CollectingEventsListener) Collect(event types.RetrievalEvent)
type DelayedClientReturn ¶ added in v0.7.0
type DelayedClientReturn struct { ResultStats *types.RetrievalStats ResultErr error Delay time.Duration }
type DelayedConnectReturn ¶ added in v0.7.0
type DiscoveredCandidate ¶ added in v0.7.0
type DiscoveredCandidate struct { Cid cid.Cid Candidate types.RetrievalCandidate }
type ExpectedActionsAtTime ¶ added in v0.7.0
type ExpectedActionsAtTime struct { AfterStart time.Duration ReceivedConnections []peer.ID ReceivedRetrievals []peer.ID CandidatesDiscovered []DiscoveredCandidate ExpectedEvents []types.RetrievalEvent }
type MockCandidateFinder ¶
type MockCandidateFinder struct {
// contains filtered or unexported fields
}
func NewMockCandidateFinder ¶ added in v0.7.0
func NewMockCandidateFinder(err error, candidates map[cid.Cid][]types.RetrievalCandidate) *MockCandidateFinder
func (*MockCandidateFinder) FindCandidates ¶
func (me *MockCandidateFinder) FindCandidates(ctx context.Context, cid cid.Cid) ([]types.RetrievalCandidate, error)
func (*MockCandidateFinder) FindCandidatesAsync ¶
func (me *MockCandidateFinder) FindCandidatesAsync(ctx context.Context, c cid.Cid, cb func(types.RetrievalCandidate)) error
func (*MockCandidateFinder) VerifyCandidatesDiscovered ¶ added in v0.7.0
func (me *MockCandidateFinder) VerifyCandidatesDiscovered(ctx context.Context, t *testing.T, expectedCandidatesDiscovered []DiscoveredCandidate)
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient ¶
func NewMockClient(connectReturns map[string]DelayedConnectReturn, retrievalReturns map[string]DelayedClientReturn, clock clock.Clock) *MockClient
func (*MockClient) GetConnectReturns ¶ added in v0.7.0
func (mc *MockClient) GetConnectReturns() map[string]DelayedConnectReturn
func (*MockClient) GetReceivedLinkSystems ¶
func (mc *MockClient) GetReceivedLinkSystems() []ipld.LinkSystem
func (*MockClient) GetRetrievalReturns ¶
func (mc *MockClient) GetRetrievalReturns() map[string]DelayedClientReturn
func (*MockClient) RetrieveFromPeer ¶
func (mc *MockClient) RetrieveFromPeer( ctx context.Context, linkSystem ipld.LinkSystem, peerID peer.ID, proposal *retrievaltypes.DealProposal, selector ipld.Node, eventsCallback datatransfer.Subscriber, gracefulShutdownRequested <-chan struct{}, ) (*types.RetrievalStats, error)
func (*MockClient) SetConnectReturns ¶ added in v0.7.0
func (mc *MockClient) SetConnectReturns(connectReturns map[string]DelayedConnectReturn)
func (*MockClient) SetRetrievalReturns ¶
func (mc *MockClient) SetRetrievalReturns(retrievalReturns map[string]DelayedClientReturn)
func (*MockClient) VerifyConnectionsReceived ¶ added in v0.7.0
func (*MockClient) VerifyReceivedRetrievalFrom ¶ added in v0.7.0
func (mc *MockClient) VerifyReceivedRetrievalFrom(ctx context.Context, t *testing.T, p peer.ID) ClientRetrievalRequest
func (*MockClient) VerifyRetrievalsReceived ¶ added in v0.7.0
type RetrievalVerifier ¶ added in v0.7.0
type RetrievalVerifier struct {
ExpectedSequence []ExpectedActionsAtTime
}
func (RetrievalVerifier) RunWithVerification ¶ added in v0.7.0
func (rv RetrievalVerifier) RunWithVerification(ctx context.Context, t *testing.T, clock *clock.Mock, mockClient *MockClient, mockCandidateFinder *MockCandidateFinder, runRetrievals []RunRetrieval) []types.RetrievalResult
type RunRetrieval ¶ added in v0.7.0
type RunRetrieval func(cb func(types.RetrievalEvent)) (*types.RetrievalStats, error)
Click to show internal directories.
Click to hide internal directories.