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 CollectingEventsListener
- type DelayedQueryReturn
- type DelayedRetrievalReturn
- type MockCandidateFinder
- type MockClient
- func (mc *MockClient) GetQueryReturns() map[string]DelayedQueryReturn
- func (mc *MockClient) GetReceivedLinkSystems() []ipld.LinkSystem
- func (mc *MockClient) GetReceivedQueries() []peer.ID
- func (mc *MockClient) GetReceivedRetrievalFrom(peer peer.ID) *RetrievalRequest
- func (mc *MockClient) GetReceivedRetrievals() []RetrievalRequest
- func (mc *MockClient) GetRetrievalReturns() map[string]DelayedRetrievalReturn
- func (mc *MockClient) RetrievalQueryToPeer(ctx context.Context, minerPeer peer.AddrInfo, pcid cid.Cid, onConnected func()) (*retrievaltypes.QueryResponse, error)
- func (mc *MockClient) RetrieveFromPeer(ctx context.Context, linkSystem ipld.LinkSystem, peerID peer.ID, ...) (*types.RetrievalStats, error)
- func (mc *MockClient) SetQueryReturns(queryReturns map[string]DelayedQueryReturn)
- func (mc *MockClient) SetRetrievalReturns(retrievalReturns map[string]DelayedRetrievalReturn)
- type RetrievalRequest
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 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 DelayedQueryReturn ¶
type DelayedQueryReturn struct { QueryResponse *retrievaltypes.QueryResponse Err error Delay time.Duration }
type DelayedRetrievalReturn ¶
type DelayedRetrievalReturn struct { ResultStats *types.RetrievalStats ResultErr error Delay time.Duration }
type MockCandidateFinder ¶
type MockCandidateFinder struct { Error error Candidates map[cid.Cid][]types.RetrievalCandidate }
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) (<-chan types.FindCandidatesResult, error)
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient ¶
func NewMockClient(queryReturns map[string]DelayedQueryReturn, retrievalReturns map[string]DelayedRetrievalReturn) *MockClient
func (*MockClient) GetQueryReturns ¶
func (mc *MockClient) GetQueryReturns() map[string]DelayedQueryReturn
func (*MockClient) GetReceivedLinkSystems ¶
func (mc *MockClient) GetReceivedLinkSystems() []ipld.LinkSystem
func (*MockClient) GetReceivedQueries ¶
func (mc *MockClient) GetReceivedQueries() []peer.ID
func (*MockClient) GetReceivedRetrievalFrom ¶ added in v0.5.0
func (mc *MockClient) GetReceivedRetrievalFrom(peer peer.ID) *RetrievalRequest
func (*MockClient) GetReceivedRetrievals ¶
func (mc *MockClient) GetReceivedRetrievals() []RetrievalRequest
func (*MockClient) GetRetrievalReturns ¶
func (mc *MockClient) GetRetrievalReturns() map[string]DelayedRetrievalReturn
func (*MockClient) RetrievalQueryToPeer ¶
func (mc *MockClient) RetrievalQueryToPeer( ctx context.Context, minerPeer peer.AddrInfo, pcid cid.Cid, onConnected func(), ) (*retrievaltypes.QueryResponse, error)
func (*MockClient) RetrieveFromPeer ¶
func (mc *MockClient) RetrieveFromPeer( ctx context.Context, linkSystem ipld.LinkSystem, peerID peer.ID, minerWallet address.Address, proposal *retrievaltypes.DealProposal, selector ipld.Node, eventsCallback datatransfer.Subscriber, gracefulShutdownRequested <-chan struct{}, ) (*types.RetrievalStats, error)
func (*MockClient) SetQueryReturns ¶
func (mc *MockClient) SetQueryReturns(queryReturns map[string]DelayedQueryReturn)
func (*MockClient) SetRetrievalReturns ¶
func (mc *MockClient) SetRetrievalReturns(retrievalReturns map[string]DelayedRetrievalReturn)
type RetrievalRequest ¶ added in v0.5.0
type RetrievalRequest struct { Peer peer.ID Proposal *retrievaltypes.DealProposal Selector ipld.Node }
Click to show internal directories.
Click to hide internal directories.