Documentation ¶
Index ¶
- Variables
- func AssertDealState(t *testing.T, expected storagemarket.StorageDealStatus, ...)
- func AssertRetrievalDealState(t *testing.T, expected, actual retrievalmarket.DealStatus)
- func ContainsBlock(blks []blocks.Block, block blocks.Block) bool
- func ContainsPeer(peers []peer.ID, p peer.ID) bool
- func CreateDenseCARv2(t *testing.T, src string) (root cid.Cid, path string)
- func CreateRefCARv2(t *testing.T, src string) (cid.Cid, string)
- func DatastoreAtVersion(t *testing.T, ds datastore.Batching, version versioning.VersionKey) datastore.Batching
- func FailDealPaymentReader() (rm.DealPayment, error)
- func FailDealPaymentWriter(rm.DealPayment) error
- func FailDealProposalReader() (rm.DealProposal, error)
- func FailDealProposalWriter(rm.DealProposal) error
- func FailDealResponseReader() (rm.DealResponse, error)
- func FailDealResponseWriter(rm.DealResponse) error
- func FailNewQueryStream(peer.ID) (rmnet.RetrievalQueryStream, error)
- func FailQueryReader() (rm.Query, error)
- func FailQueryWriter(rm.Query) error
- func FailResponseReader() (rm.QueryResponse, error)
- func FailResponseWriter(rm.QueryResponse) error
- func FailStorageProposalReader() (smnet.Proposal, error)
- func FailStorageProposalWriter(smnet.Proposal) error
- func FailStorageResponseReader() (smnet.SignedResponse, []byte, error)
- func FailStorageResponseWriter(smnet.SignedResponse) error
- func GenerateBlocksOfSize(n int, size int64) []blocks.Block
- func GenerateCid(t *testing.T, o interface{}) cid.Cid
- func GenerateCids(n int) []cid.Cid
- func GeneratePeers(n int) []peer.ID
- func IndexOf(blks []blocks.Block, c cid.Cid) int
- func MakeIdentityCidWith(cids []cid.Cid, codec multicodec.Code, padding ...[]byte) (cid.Cid, error)
- func MakeTestChannelID() datatransfer.ChannelID
- func MakeTestClientDeal(state storagemarket.StorageDealStatus, ...) (*storagemarket.ClientDeal, error)
- func MakeTestClientDealProposal() *market.ClientDealProposal
- func MakeTestDataRef(manualXfer bool) *storagemarket.DataRef
- func MakeTestDealProposal() *retrievalmarket.DealProposal
- func MakeTestDealStatusRequest() smnet.DealStatusRequest
- func MakeTestDealStatusResponse() smnet.DealStatusResponse
- func MakeTestMerge() paych.Merge
- func MakeTestMinerDeal(state storagemarket.StorageDealStatus, ...) (*storagemarket.MinerDeal, error)
- func MakeTestModVerifyParams() *paych.ModVerifyParams
- func MakeTestQueryResponse() retrievalmarket.QueryResponse
- func MakeTestSignature() *crypto.Signature
- func MakeTestSignedStorageAsk() *storagemarket.SignedStorageAsk
- func MakeTestSignedVoucher() *paych.SignedVoucher
- func MakeTestStorageAsk() *storagemarket.StorageAsk
- func MakeTestStorageAskRequest() smnet.AskRequest
- func MakeTestStorageAskResponse() smnet.AskResponse
- func MakeTestStorageNetworkProposal() smnet.Proposal
- func MakeTestStorageNetworkResponse() smnet.Response
- func MakeTestStorageNetworkSignedResponse() smnet.SignedResponse
- func MakeTestTokenAmount() abi.TokenAmount
- func MakeTestUnsignedDealProposal() market.DealProposal
- func NewIDAddr(t testing.TB, id uint64) address.Address
- func NewTestChannel(params TestChannelParams) datatransfer.ChannelState
- func QueryReadWriter() (QueryReader, QueryWriter)
- func QueryResponseReadWriter() (QueryResponseReader, QueryResponseWriter)
- func RandomBytes(n int64) []byte
- func RequireGenerateRetrievalPeers(t *testing.T, numPeers int) []retrievalmarket.RetrievalPeer
- func StartAndWaitForReady(ctx context.Context, t *testing.T, startAndWaitable StartAndWaitable)
- func StartAndWaitForReadyDT(ctx context.Context, t *testing.T, startAndWaitable datatransfer.Manager)
- func TestVoucherEquality(t *testing.T, a, b *paych.SignedVoucher)
- func ThisDir(t *testing.T) string
- func TrivialNewQueryStream(p peer.ID) (rmnet.RetrievalQueryStream, error)
- func TrivialQueryReader() (rm.Query, error)
- func TrivialQueryResponseReader() (rm.QueryResponse, error)
- func TrivialQueryResponseWriter(rm.QueryResponse) error
- func TrivialQueryWriter(rm.Query) error
- func TrivialStorageDealProposalReader() (smnet.Proposal, error)
- func TrivialStorageDealProposalWriter(smnet.Proposal) error
- func TrivialStorageDealResponseReader() (smnet.SignedResponse, []byte, error)
- func TrivialStorageDealResponseWriter(smnet.SignedResponse, smnet.ResigningFunc) error
- type DealPaymentReader
- type DealPaymentWriter
- type DealProposalReader
- type DealProposalWriter
- type DealResponseReader
- type DealResponseWriter
- type FakeDTValidator
- func (v *FakeDTValidator) ValidatePull(_ datatransfer.ChannelID, receiver peer.ID, voucher datamodel.Node, ...) (datatransfer.ValidationResult, error)
- func (v *FakeDTValidator) ValidatePush(_ datatransfer.ChannelID, sender peer.ID, voucher datamodel.Node, ...) (datatransfer.ValidationResult, error)
- func (v *FakeDTValidator) ValidateRestart(_ datatransfer.ChannelID, channelState datatransfer.ChannelState) (datatransfer.ValidationResult, error)
- type Libp2pTestData
- func (ltd *Libp2pTestData) LoadUnixFSFile(t *testing.T, src string, useSecondNode bool) (datamodel.Link, string)
- func (ltd *Libp2pTestData) LoadUnixFSFileToStore(t *testing.T, src string) (datamodel.Link, string)
- func (ltd *Libp2pTestData) VerifyFileTransferred(t *testing.T, link datamodel.Link, useSecondNode bool, readLen uint64)
- func (ltd *Libp2pTestData) VerifyFileTransferredIntoStore(t *testing.T, link datamodel.Link, bs bstore.Blockstore, readLen uint64)
- type MockDagStoreWrapper
- func (m *MockDagStoreWrapper) AddBlockToPieceIndex(blockCID cid.Cid, pieceCid cid.Cid)
- func (m *MockDagStoreWrapper) ClearRegistrations()
- func (m *MockDagStoreWrapper) Close() error
- func (m *MockDagStoreWrapper) DestroyShard(ctx context.Context, pieceCid cid.Cid, resch chan dagstore.ShardResult) error
- func (m *MockDagStoreWrapper) GetIterableIndexForPiece(c cid.Cid) (carindex.IterableIndex, error)
- func (m *MockDagStoreWrapper) GetPiecesContainingBlock(blockCID cid.Cid) ([]cid.Cid, error)
- func (m *MockDagStoreWrapper) GetRegistration(pieceCid cid.Cid) (registration, bool)
- func (m *MockDagStoreWrapper) LenRegistrations() int
- func (m *MockDagStoreWrapper) LoadShard(ctx context.Context, pieceCid cid.Cid) (stores.ClosableBlockstore, error)
- func (m *MockDagStoreWrapper) MigrateDeals(ctx context.Context, deals []storagemarket.MinerDeal) (bool, error)
- func (m *MockDagStoreWrapper) RegisterShard(ctx context.Context, pieceCid cid.Cid, carPath string, eagerInit bool, ...) error
- type MockIndexProvider
- func (m *MockIndexProvider) GetNotifs() map[string]metadata.Metadata
- func (m *MockIndexProvider) NotifyPut(ctx context.Context, addr *peer.AddrInfo, contextID []byte, ...) (cid.Cid, error)
- func (m *MockIndexProvider) NotifyRemove(ctx context.Context, p peer.ID, contextID []byte) (cid.Cid, error)
- func (m *MockIndexProvider) RegisterMultihashLister(cb provider.MultihashLister)
- type QueryReader
- type QueryResponseReader
- type QueryResponseWriter
- type QueryStreamBuilder
- type QueryWriter
- type RegisteredTransportConfigurer
- type RegisteredVoucherType
- type StartAndWaitable
- type StorageDealProposalReader
- type StorageDealProposalWriter
- type StorageDealResponseReader
- type StorageDealResponseWriter
- type TestChannel
- func (tc *TestChannel) BaseCID() cid.Cid
- func (tc *TestChannel) BothPaused() bool
- func (tc *TestChannel) ChannelID() datatransfer.ChannelID
- func (tc *TestChannel) DataLimit() uint64
- func (tc *TestChannel) InitiatorPaused() bool
- func (tc *TestChannel) IsPull() bool
- func (tc *TestChannel) LastVoucher() datatransfer.TypedVoucher
- func (tc *TestChannel) LastVoucherResult() datatransfer.TypedVoucher
- func (tc *TestChannel) Message() string
- func (tc *TestChannel) MissingCids() []cid.Cid
- func (tc *TestChannel) OtherParty(thisParty peer.ID) peer.ID
- func (tc *TestChannel) OtherPeer() peer.ID
- func (tc *TestChannel) Queued() uint64
- func (tc *TestChannel) QueuedCidsTotal() int64
- func (tc *TestChannel) Received() uint64
- func (tc *TestChannel) ReceivedCids() []cid.Cid
- func (tc *TestChannel) ReceivedCidsLen() int
- func (tc *TestChannel) ReceivedCidsTotal() int64
- func (tc *TestChannel) Recipient() peer.ID
- func (tc *TestChannel) RequiresFinalization() bool
- func (tc *TestChannel) ResponderPaused() bool
- func (tc *TestChannel) Selector() datamodel.Node
- func (tc *TestChannel) SelfPaused() bool
- func (tc *TestChannel) SelfPeer() peer.ID
- func (tc *TestChannel) Sender() peer.ID
- func (tc *TestChannel) Sent() uint64
- func (tc *TestChannel) SentCidsTotal() int64
- func (tc *TestChannel) Stages() *datatransfer.ChannelStages
- func (tc *TestChannel) Status() datatransfer.Status
- func (tc *TestChannel) TotalSize() uint64
- func (tc *TestChannel) TransferID() datatransfer.TransferID
- func (tc *TestChannel) Voucher() datatransfer.TypedVoucher
- func (tc *TestChannel) VoucherResults() []datatransfer.TypedVoucher
- func (tc *TestChannel) Vouchers() []datatransfer.TypedVoucher
- type TestChannelParams
- type TestDataTransfer
- func (tdt *TestDataTransfer) ChannelState(ctx context.Context, chid datatransfer.ChannelID) (datatransfer.ChannelState, error)
- func (tdt *TestDataTransfer) CloseDataTransferChannel(ctx context.Context, chid datatransfer.ChannelID) error
- func (tdt *TestDataTransfer) InProgressChannels(ctx context.Context) (map[datatransfer.ChannelID]datatransfer.ChannelState, error)
- func (tdt *TestDataTransfer) OnReady(f datatransfer.ReadyFunc)
- func (tdt *TestDataTransfer) OpenPullDataChannel(ctx context.Context, to peer.ID, voucher datatransfer.TypedVoucher, ...) (datatransfer.ChannelID, error)
- func (tdt *TestDataTransfer) OpenPushDataChannel(ctx context.Context, to peer.ID, voucher datatransfer.TypedVoucher, ...) (datatransfer.ChannelID, error)
- func (tdt *TestDataTransfer) PauseDataTransferChannel(ctx context.Context, chid datatransfer.ChannelID) error
- func (tdt *TestDataTransfer) RegisterTransportConfigurer(voucherType datatransfer.TypeIdentifier, ...) error
- func (tdt *TestDataTransfer) RegisterVoucherType(voucherType datatransfer.TypeIdentifier, ...) error
- func (tdt *TestDataTransfer) RestartDataTransferChannel(ctx context.Context, chId datatransfer.ChannelID) error
- func (tdt *TestDataTransfer) ResumeDataTransferChannel(ctx context.Context, chid datatransfer.ChannelID) error
- func (tdt *TestDataTransfer) SendVoucher(ctx context.Context, chid datatransfer.ChannelID, ...) error
- func (tdt *TestDataTransfer) SendVoucherResult(ctx context.Context, chid datatransfer.ChannelID, ...) error
- func (tdt *TestDataTransfer) Start(ctx context.Context) error
- func (tdt *TestDataTransfer) Stop(context.Context) error
- func (tdt *TestDataTransfer) SubscribeToEvents(subscriber datatransfer.Subscriber) datatransfer.Unsubscribe
- func (tdt *TestDataTransfer) TransferChannelStatus(ctx context.Context, x datatransfer.ChannelID) datatransfer.Status
- func (tdt *TestDataTransfer) UpdateValidationStatus(ctx context.Context, chid datatransfer.ChannelID, ...) error
- type TestDealFunds
- type TestDealStreamParams
- type TestFile
- type TestFileParams
- type TestFileStore
- func (fs *TestFileStore) Create(p filestore.Path) (filestore.File, error)
- func (fs *TestFileStore) CreateTemp() (filestore.File, error)
- func (fs *TestFileStore) Delete(p filestore.Path) error
- func (fs *TestFileStore) Open(p filestore.Path) (filestore.File, error)
- func (fs *TestFileStore) Store(p filestore.Path, f filestore.File) (filestore.Path, error)
- func (fs *TestFileStore) VerifyExpectations(t *testing.T)
- type TestFileStoreParams
- type TestIPLDTree
- type TestNetworkParams
- type TestPeerResolver
- type TestPeerTagger
- type TestPieceStore
- func (tps *TestPieceStore) AddDealForPiece(pieceCID cid.Cid, _ cid.Cid, dealInfo piecestore.DealInfo) error
- func (tps *TestPieceStore) AddPieceBlockLocations(pieceCID cid.Cid, blockLocations map[cid.Cid]piecestore.BlockLocation) error
- func (tps *TestPieceStore) ExpectCID(c cid.Cid, cidInfo piecestore.CIDInfo)
- func (tps *TestPieceStore) ExpectMissingCID(c cid.Cid)
- func (tps *TestPieceStore) ExpectMissingPiece(pieceCid cid.Cid)
- func (tps *TestPieceStore) ExpectPiece(pieceCid cid.Cid, pieceInfo piecestore.PieceInfo)
- func (tps *TestPieceStore) GetCIDInfo(c cid.Cid) (piecestore.CIDInfo, error)
- func (tps *TestPieceStore) GetPieceInfo(pieceCID cid.Cid) (piecestore.PieceInfo, error)
- func (tps *TestPieceStore) ListCidInfoKeys() ([]cid.Cid, error)
- func (tps *TestPieceStore) ListPieceInfoKeys() ([]cid.Cid, error)
- func (tps *TestPieceStore) OnReady(ready shared.ReadyFunc)
- func (tps *TestPieceStore) ReturnErrorFromGetPieceInfo(err error)
- func (tps *TestPieceStore) Start(ctx context.Context) error
- func (tps *TestPieceStore) StubCID(c cid.Cid, cidInfo piecestore.CIDInfo)
- func (tps *TestPieceStore) StubPiece(pieceCid cid.Cid, pieceInfo piecestore.PieceInfo)
- func (tps *TestPieceStore) VerifyExpectations(t *testing.T)
- type TestPieceStoreParams
- type TestQueryStreamParams
- type TestRetrievalBlockstoreAccessor
- type TestRetrievalDealStream
- type TestRetrievalMarketNetwork
- func (trmn *TestRetrievalMarketNetwork) AddAddrs(peer.ID, []ma.Multiaddr)
- func (trmn *TestRetrievalMarketNetwork) ID() peer.ID
- func (trmn *TestRetrievalMarketNetwork) NewQueryStream(id peer.ID) (rmnet.RetrievalQueryStream, error)
- func (trmn *TestRetrievalMarketNetwork) ReceiveQueryStream(qs rmnet.RetrievalQueryStream)
- func (trmn *TestRetrievalMarketNetwork) SetDelegate(r rmnet.RetrievalReceiver) error
- func (trmn *TestRetrievalMarketNetwork) StopHandlingRequests() error
- type TestRetrievalQueryStream
- func (trqs *TestRetrievalQueryStream) Close() error
- func (trqs *TestRetrievalQueryStream) ReadQuery() (rm.Query, error)
- func (trqs *TestRetrievalQueryStream) ReadQueryResponse() (rm.QueryResponse, error)
- func (trqs *TestRetrievalQueryStream) RemotePeer() peer.ID
- func (trqs *TestRetrievalQueryStream) SetRemotePeer(rp peer.ID)
- func (trqs *TestRetrievalQueryStream) WriteQuery(newQuery rm.Query) error
- func (trqs *TestRetrievalQueryStream) WriteQueryResponse(newResp rm.QueryResponse) error
- type TestStorageBlockstoreAccessor
- type TestStorageDealStream
- func (tsds *TestStorageDealStream) Close() error
- func (tsds *TestStorageDealStream) ReadDealProposal() (smnet.Proposal, error)
- func (tsds *TestStorageDealStream) ReadDealResponse() (smnet.SignedResponse, []byte, error)
- func (tsds TestStorageDealStream) RemotePeer() peer.ID
- func (tsds *TestStorageDealStream) WriteDealProposal(dealProposal smnet.Proposal) error
- func (tsds *TestStorageDealStream) WriteDealResponse(dealResponse smnet.SignedResponse, resigningFunc smnet.ResigningFunc) error
- type TestStorageDealStreamParams
Constants ¶
This section is empty.
Variables ¶
var TestErrNotFound = errors.New("file not found")
var TestErrTempFile = errors.New("temp file creation failed")
Functions ¶
func AssertDealState ¶
func AssertDealState(t *testing.T, expected storagemarket.StorageDealStatus, actual storagemarket.StorageDealStatus)
AssertDealState asserts equality of StorageDealStatus but with better error messaging
func AssertRetrievalDealState ¶
func AssertRetrievalDealState(t *testing.T, expected, actual retrievalmarket.DealStatus)
func ContainsBlock ¶
ContainsBlock returns true if a block is found n a list of blocks
func ContainsPeer ¶
ContainsPeer returns true if a peer is found n a list of peers.
func CreateDenseCARv2 ¶
CreateDenseCARv2 generates a "dense" UnixFS CARv2 from the supplied ordinary file. A dense UnixFS CARv2 is one storing leaf data. Contrast to CreateRefCARv2.
func CreateRefCARv2 ¶
CreateRefCARv2 generates a "ref" CARv2 from the supplied ordinary file. A "ref" CARv2 is one that stores leaf data as positional references to the original file.
func DatastoreAtVersion ¶
func DatastoreAtVersion(t *testing.T, ds datastore.Batching, version versioning.VersionKey) datastore.Batching
func FailDealPaymentReader ¶
func FailDealPaymentReader() (rm.DealPayment, error)
FailDealPaymentReader always fails
func FailDealPaymentWriter ¶
func FailDealPaymentWriter(rm.DealPayment) error
FailDealPaymentWriter always fails
func FailDealProposalReader ¶
func FailDealProposalReader() (rm.DealProposal, error)
FailDealProposalReader always fails
func FailDealProposalWriter ¶
func FailDealProposalWriter(rm.DealProposal) error
FailDealProposalWriter always fails
func FailDealResponseReader ¶
func FailDealResponseReader() (rm.DealResponse, error)
FailDealResponseReader always fails
func FailDealResponseWriter ¶
func FailDealResponseWriter(rm.DealResponse) error
FailDealResponseWriter always fails
func FailNewQueryStream ¶
func FailNewQueryStream(peer.ID) (rmnet.RetrievalQueryStream, error)
FailNewQueryStream always fails
func FailResponseReader ¶
func FailResponseReader() (rm.QueryResponse, error)
FailResponseReader always fails
func FailResponseWriter ¶
func FailResponseWriter(rm.QueryResponse) error
FailResponseWriter always fails
func FailStorageProposalReader ¶
FailStorageProposalReader always fails
func FailStorageProposalWriter ¶
FailStorageProposalWriter always fails
func FailStorageResponseReader ¶
func FailStorageResponseReader() (smnet.SignedResponse, []byte, error)
FailStorageResponseReader always fails
func FailStorageResponseWriter ¶
func FailStorageResponseWriter(smnet.SignedResponse) error
FailStorageResponseWriter always fails
func GenerateBlocksOfSize ¶
GenerateBlocksOfSize generates a series of blocks of the given byte size
func GenerateCid ¶
func MakeIdentityCidWith ¶
MakeIdentityCidWith will create either a dag-pb or dag-cbor identity CID containing the provided list of CIDs and optional byte blocks. The dag-cbor identity CID will be a simple list with all items appended. This can also be used recursively to increase the ridiculousness.
func MakeTestChannelID ¶
func MakeTestChannelID() datatransfer.ChannelID
MakeTestChannelID makes a new empty data transfer channel ID
func MakeTestClientDeal ¶
func MakeTestClientDeal(state storagemarket.StorageDealStatus, clientDealProposal *market.ClientDealProposal, manualXfer bool) (*storagemarket.ClientDeal, error)
MakeTestClientDeal returns a storage market client deal
func MakeTestClientDealProposal ¶
func MakeTestClientDealProposal() *market.ClientDealProposal
MakeTestClientDealProposal generates a valid storage deal proposal
func MakeTestDataRef ¶
func MakeTestDataRef(manualXfer bool) *storagemarket.DataRef
MakeTestDataRef returns a storage market data ref
func MakeTestDealProposal ¶
func MakeTestDealProposal() *retrievalmarket.DealProposal
MakeTestDealProposal generates a valid, random DealProposal
func MakeTestDealStatusRequest ¶
func MakeTestDealStatusRequest() smnet.DealStatusRequest
MakeTestDealStatusRequest generates a request to get a provider's query
func MakeTestDealStatusResponse ¶
func MakeTestDealStatusResponse() smnet.DealStatusResponse
MakeTestDealStatusResponse generates a response to an query request
func MakeTestMerge ¶
MakeTestMerge generates a random Merge that has all non-zero fields
func MakeTestMinerDeal ¶
func MakeTestMinerDeal(state storagemarket.StorageDealStatus, clientDealProposal *market.ClientDealProposal, dataRef *storagemarket.DataRef) (*storagemarket.MinerDeal, error)
MakeTestMinerDeal returns a storage market provider deal
func MakeTestModVerifyParams ¶
func MakeTestModVerifyParams() *paych.ModVerifyParams
MakeTestModVerifyParams generates a random ModVerifyParams that has all non-zero fields
func MakeTestQueryResponse ¶
func MakeTestQueryResponse() retrievalmarket.QueryResponse
MakeTestQueryResponse generates a valid, random QueryResponse with no non-zero fields
func MakeTestSignature ¶
MakeTestSignature generates a valid yet random Signature with all non-zero fields
func MakeTestSignedStorageAsk ¶
func MakeTestSignedStorageAsk() *storagemarket.SignedStorageAsk
MakeTestSignedStorageAsk generates a signed storage ask
func MakeTestSignedVoucher ¶
func MakeTestSignedVoucher() *paych.SignedVoucher
MakeTestSignedVoucher generates a random SignedVoucher that has all non-zero fields
func MakeTestStorageAsk ¶
func MakeTestStorageAsk() *storagemarket.StorageAsk
MakeTestStorageAsk generates a storage ask
func MakeTestStorageAskRequest ¶
func MakeTestStorageAskRequest() smnet.AskRequest
MakeTestStorageAskRequest generates a request to get a provider's ask
func MakeTestStorageAskResponse ¶
func MakeTestStorageAskResponse() smnet.AskResponse
MakeTestStorageAskResponse generates a response to an ask request
func MakeTestStorageNetworkProposal ¶
MakeTestStorageNetworkProposal generates a proposal that can be sent over the network to a provider
func MakeTestStorageNetworkResponse ¶
MakeTestStorageNetworkResponse generates a response to a proposal sent over the network
func MakeTestStorageNetworkSignedResponse ¶
func MakeTestStorageNetworkSignedResponse() smnet.SignedResponse
MakeTestStorageNetworkSignedResponse generates a response to a proposal sent over the network that is signed
func MakeTestTokenAmount ¶
func MakeTestTokenAmount() abi.TokenAmount
MakeTestTokenAmount generates a valid yet random TokenAmount with a non-zero value.
func MakeTestUnsignedDealProposal ¶
func MakeTestUnsignedDealProposal() market.DealProposal
MakeTestUnsignedDealProposal generates a deal proposal with no signature
func NewTestChannel ¶
func NewTestChannel(params TestChannelParams) datatransfer.ChannelState
NewTestChannel makes a test channel with default params plus non-zero values for TestChannelParams
func QueryReadWriter ¶
func QueryReadWriter() (QueryReader, QueryWriter)
QueryReadWriter will read only if something is written, otherwise it errors
func QueryResponseReadWriter ¶
func QueryResponseReadWriter() (QueryResponseReader, QueryResponseWriter)
QueryResponseReadWriter will read only if something is written, otherwise it errors
func RandomBytes ¶
RandomBytes returns a byte array of the given size with random values.
func RequireGenerateRetrievalPeers ¶
func RequireGenerateRetrievalPeers(t *testing.T, numPeers int) []retrievalmarket.RetrievalPeer
func StartAndWaitForReady ¶
func StartAndWaitForReady(ctx context.Context, t *testing.T, startAndWaitable StartAndWaitable)
StartAndWaitForReady is a utility function to start a module and verify it reaches the ready state
func StartAndWaitForReadyDT ¶
func StartAndWaitForReadyDT(ctx context.Context, t *testing.T, startAndWaitable datatransfer.Manager)
StartAndWaitForReadyDT is a utility function to start a go-data-transfer and verify it reaches the ready state
func TestVoucherEquality ¶
func TestVoucherEquality(t *testing.T, a, b *paych.SignedVoucher)
TestVoucherEquality verifies that two vouchers are equal to one another
func TrivialNewQueryStream ¶
func TrivialNewQueryStream(p peer.ID) (rmnet.RetrievalQueryStream, error)
TrivialNewQueryStream succeeds trivially, returning an empty query stream.
func TrivialQueryReader ¶
TrivialQueryReader succeeds trivially, returning an empty query.
func TrivialQueryResponseReader ¶
func TrivialQueryResponseReader() (rm.QueryResponse, error)
TrivialQueryResponseReader succeeds trivially, returning an empty query response.
func TrivialQueryResponseWriter ¶
func TrivialQueryResponseWriter(rm.QueryResponse) error
TrivialQueryResponseWriter succeeds trivially, returning no error.
func TrivialQueryWriter ¶
TrivialQueryWriter succeeds trivially, returning no error.
func TrivialStorageDealProposalReader ¶
TrivialStorageDealProposalReader succeeds trivially, returning an empty proposal.
func TrivialStorageDealProposalWriter ¶
TrivialStorageDealProposalWriter succeeds trivially, returning no error.
func TrivialStorageDealResponseReader ¶
func TrivialStorageDealResponseReader() (smnet.SignedResponse, []byte, error)
TrivialStorageDealResponseReader succeeds trivially, returning an empty deal response.
func TrivialStorageDealResponseWriter ¶
func TrivialStorageDealResponseWriter(smnet.SignedResponse, smnet.ResigningFunc) error
TrivialStorageDealResponseWriter succeeds trivially, returning no error.
Types ¶
type DealPaymentReader ¶
type DealPaymentReader func() (rm.DealPayment, error)
DealPaymentReader is a function to mock reading deal payments.
func StubbedDealPaymentReader ¶
func StubbedDealPaymentReader(payment rm.DealPayment) DealPaymentReader
StubbedDealPaymentReader returns the given deal payment when called
type DealPaymentWriter ¶
type DealPaymentWriter func(rm.DealPayment) error
DealPaymentWriter is a function to mock writing deal payments.
type DealProposalReader ¶
type DealProposalReader func() (rm.DealProposal, error)
DealProposalReader is a function to mock reading deal proposals.
func StubbedDealProposalReader ¶
func StubbedDealProposalReader(proposal rm.DealProposal) DealProposalReader
StubbedDealProposalReader returns the given proposal when called
type DealProposalWriter ¶
type DealProposalWriter func(rm.DealProposal) error
DealProposalWriter is a function to mock writing deal proposals.
type DealResponseReader ¶
type DealResponseReader func() (rm.DealResponse, error)
DealResponseReader is a function to mock reading deal responses.
func StubbedDealResponseReader ¶
func StubbedDealResponseReader(response rm.DealResponse) DealResponseReader
StubbedDealResponseReader returns the given deal response when called
type DealResponseWriter ¶
type DealResponseWriter func(rm.DealResponse) error
DealResponseWriter is a function to mock writing deal responses.
func ExpectDealResponseWriter ¶
func ExpectDealResponseWriter(t *testing.T, expectedDealResponse rm.DealResponse, msgAndArgs ...interface{}) DealResponseWriter
ExpectDealResponseWriter will fail if the written query and expected query don't match
type FakeDTValidator ¶
type FakeDTValidator struct{}
func (*FakeDTValidator) ValidatePull ¶
func (v *FakeDTValidator) ValidatePull(_ datatransfer.ChannelID, receiver peer.ID, voucher datamodel.Node, baseCid cid.Cid, selector datamodel.Node) (datatransfer.ValidationResult, error)
func (*FakeDTValidator) ValidatePush ¶
func (v *FakeDTValidator) ValidatePush(_ datatransfer.ChannelID, sender peer.ID, voucher datamodel.Node, baseCid cid.Cid, selector datamodel.Node) (datatransfer.ValidationResult, error)
func (*FakeDTValidator) ValidateRestart ¶
func (v *FakeDTValidator) ValidateRestart(_ datatransfer.ChannelID, channelState datatransfer.ChannelState) (datatransfer.ValidationResult, error)
type Libp2pTestData ¶
type Libp2pTestData struct { Ctx context.Context Ds1 datastore.Batching Ds2 datastore.Batching Bs1 bstore.Blockstore Bs2 bstore.Blockstore DagService1 ipldformat.DAGService DagService2 ipldformat.DAGService DTNet1 dtnet.DataTransferNetwork DTNet2 dtnet.DataTransferNetwork DTStore1 datastore.Batching DTStore2 datastore.Batching DTTmpDir1 string DTTmpDir2 string LinkSystem1 ipld.LinkSystem LinkSystem2 ipld.LinkSystem Host1 host.Host Host2 host.Host OrigBytes []byte MockNet mocknet.Mocknet }
func NewLibp2pTestData ¶
func NewLibp2pTestData(ctx context.Context, t *testing.T) *Libp2pTestData
func (*Libp2pTestData) LoadUnixFSFile ¶
func (ltd *Libp2pTestData) LoadUnixFSFile(t *testing.T, src string, useSecondNode bool) (datamodel.Link, string)
LoadUnixFSFile injects the fixture `src` into the given blockstore from the fixtures directory. If useSecondNode is true, fixture is injected to the second node; otherwise the first node gets it
func (*Libp2pTestData) LoadUnixFSFileToStore ¶
LoadUnixFSFileToStore creates a CAR file from the fixture at `src`
func (*Libp2pTestData) VerifyFileTransferred ¶
func (ltd *Libp2pTestData) VerifyFileTransferred(t *testing.T, link datamodel.Link, useSecondNode bool, readLen uint64)
VerifyFileTransferred checks that the fixture file was sent from one node to the other.
func (*Libp2pTestData) VerifyFileTransferredIntoStore ¶
func (ltd *Libp2pTestData) VerifyFileTransferredIntoStore(t *testing.T, link datamodel.Link, bs bstore.Blockstore, readLen uint64)
VerifyFileTransferredIntoStore checks that the fixture file was sent from one node to the other, and stored in the given CAR file
type MockDagStoreWrapper ¶
type MockDagStoreWrapper struct {
// contains filtered or unexported fields
}
MockDagStoreWrapper is used to mock out the DAG store wrapper operations for the tests. It simulates getting deal info from a piece store and unsealing the data for the deal from a retrieval provider node.
func NewMockDagStoreWrapper ¶
func NewMockDagStoreWrapper(pieceStore piecestore.PieceStore, sa retrievalmarket.SectorAccessor) *MockDagStoreWrapper
func (*MockDagStoreWrapper) AddBlockToPieceIndex ¶
func (m *MockDagStoreWrapper) AddBlockToPieceIndex(blockCID cid.Cid, pieceCid cid.Cid)
Used by the tests to add an entry to the index of block CID -> []piece CID
func (*MockDagStoreWrapper) ClearRegistrations ¶
func (m *MockDagStoreWrapper) ClearRegistrations()
func (*MockDagStoreWrapper) Close ¶
func (m *MockDagStoreWrapper) Close() error
func (*MockDagStoreWrapper) DestroyShard ¶
func (m *MockDagStoreWrapper) DestroyShard(ctx context.Context, pieceCid cid.Cid, resch chan dagstore.ShardResult) error
func (*MockDagStoreWrapper) GetIterableIndexForPiece ¶
func (m *MockDagStoreWrapper) GetIterableIndexForPiece(c cid.Cid) (carindex.IterableIndex, error)
func (*MockDagStoreWrapper) GetPiecesContainingBlock ¶
func (m *MockDagStoreWrapper) GetPiecesContainingBlock(blockCID cid.Cid) ([]cid.Cid, error)
func (*MockDagStoreWrapper) GetRegistration ¶
func (m *MockDagStoreWrapper) GetRegistration(pieceCid cid.Cid) (registration, bool)
func (*MockDagStoreWrapper) LenRegistrations ¶
func (m *MockDagStoreWrapper) LenRegistrations() int
func (*MockDagStoreWrapper) LoadShard ¶
func (m *MockDagStoreWrapper) LoadShard(ctx context.Context, pieceCid cid.Cid) (stores.ClosableBlockstore, error)
func (*MockDagStoreWrapper) MigrateDeals ¶
func (m *MockDagStoreWrapper) MigrateDeals(ctx context.Context, deals []storagemarket.MinerDeal) (bool, error)
func (*MockDagStoreWrapper) RegisterShard ¶
func (m *MockDagStoreWrapper) RegisterShard(ctx context.Context, pieceCid cid.Cid, carPath string, eagerInit bool, resch chan dagstore.ShardResult) error
type MockIndexProvider ¶
func NewMockIndexProvider ¶
func NewMockIndexProvider() *MockIndexProvider
func (*MockIndexProvider) GetNotifs ¶
func (m *MockIndexProvider) GetNotifs() map[string]metadata.Metadata
func (*MockIndexProvider) NotifyRemove ¶
func (*MockIndexProvider) RegisterMultihashLister ¶
func (m *MockIndexProvider) RegisterMultihashLister(cb provider.MultihashLister)
type QueryReader ¶
QueryReader is a function to mock reading queries.
func StubbedQueryReader ¶
func StubbedQueryReader(query rm.Query) QueryReader
StubbedQueryReader returns the given query when called
type QueryResponseReader ¶
type QueryResponseReader func() (rm.QueryResponse, error)
QueryResponseReader is a function to mock reading query responses.
func StubbedQueryResponseReader ¶
func StubbedQueryResponseReader(queryResponse rm.QueryResponse) QueryResponseReader
StubbedQueryResponseReader returns the given query response when called
type QueryResponseWriter ¶
type QueryResponseWriter func(rm.QueryResponse) error
QueryResponseWriter is a function to mock writing query responses.
func ExpectQueryResponseWriter ¶
func ExpectQueryResponseWriter(t *testing.T, expectedQueryResponse rm.QueryResponse, msgAndArgs ...interface{}) QueryResponseWriter
ExpectQueryResponseWriter will fail if the written query response and expected query response don't match
type QueryStreamBuilder ¶
type QueryStreamBuilder func(peer.ID) (rmnet.RetrievalQueryStream, error)
QueryStreamBuilder is a function that builds retrieval query streams.
func ExpectPeerOnQueryStreamBuilder ¶
func ExpectPeerOnQueryStreamBuilder(t *testing.T, expectedPeer peer.ID, qb QueryStreamBuilder, msgAndArgs ...interface{}) QueryStreamBuilder
ExpectPeerOnQueryStreamBuilder fails if the peer used does not match the expected peer
type QueryWriter ¶
QueryWriter is a function to mock writing queries.
func ExpectQueryWriter ¶
func ExpectQueryWriter(t *testing.T, expectedQuery rm.Query, msgAndArgs ...interface{}) QueryWriter
ExpectQueryWriter will fail if the written query and expected query don't match
type RegisteredTransportConfigurer ¶
type RegisteredTransportConfigurer struct { VoucherType datatransfer.TypeIdentifier Configurer datatransfer.TransportConfigurer }
RegisteredTransportConfigurer records transport configurer registered for a voucher type
type RegisteredVoucherType ¶
type RegisteredVoucherType struct { VoucherType datatransfer.TypeIdentifier Validator datatransfer.RequestValidator }
RegisteredVoucherType records a voucher typed that was registered
type StartAndWaitable ¶
StartAndWaitable is any interface that can be started up and will be asynchronously ready later
type StorageDealProposalReader ¶
StorageDealProposalReader is a function to mock reading deal proposals.
func StubbedStorageProposalReader ¶
func StubbedStorageProposalReader(proposal smnet.Proposal) StorageDealProposalReader
StubbedStorageProposalReader returns the given proposal when called
type StorageDealProposalWriter ¶
StorageDealProposalWriter is a function to mock writing deal proposals.
type StorageDealResponseReader ¶
type StorageDealResponseReader func() (smnet.SignedResponse, []byte, error)
StorageDealResponseReader is a function to mock reading deal responses.
func StubbedStorageResponseReader ¶
func StubbedStorageResponseReader(response smnet.SignedResponse) StorageDealResponseReader
StubbedStorageResponseReader returns the given deal response when called
type StorageDealResponseWriter ¶
type StorageDealResponseWriter func(smnet.SignedResponse, smnet.ResigningFunc) error
StorageDealResponseWriter is a function to mock writing deal responses.
type TestChannel ¶
type TestChannel struct {
// contains filtered or unexported fields
}
TestChannel implements a datatransfer channel with set values
func (*TestChannel) BaseCID ¶
func (tc *TestChannel) BaseCID() cid.Cid
BaseCID returns the CID that is at the root of this data transfer
func (*TestChannel) BothPaused ¶
func (tc *TestChannel) BothPaused() bool
func (*TestChannel) ChannelID ¶
func (tc *TestChannel) ChannelID() datatransfer.ChannelID
ChannelID returns the channel id for this channel
func (*TestChannel) DataLimit ¶
func (tc *TestChannel) DataLimit() uint64
func (*TestChannel) InitiatorPaused ¶
func (tc *TestChannel) InitiatorPaused() bool
func (*TestChannel) IsPull ¶
func (tc *TestChannel) IsPull() bool
IsPull returns whether this is a pull request based on who initiated it
func (*TestChannel) LastVoucher ¶
func (tc *TestChannel) LastVoucher() datatransfer.TypedVoucher
LastVoucher returns the last voucher sent on the channel
func (*TestChannel) LastVoucherResult ¶
func (tc *TestChannel) LastVoucherResult() datatransfer.TypedVoucher
LastVoucherResult returns the last voucher result sent on the channel
func (*TestChannel) Message ¶
func (tc *TestChannel) Message() string
Message offers additional information about the current status
func (*TestChannel) MissingCids ¶
func (tc *TestChannel) MissingCids() []cid.Cid
TODO actual implementation of those
func (*TestChannel) OtherParty ¶
func (tc *TestChannel) OtherParty(thisParty peer.ID) peer.ID
OtherParty returns the opposite party in the channel to the passed in party
func (*TestChannel) OtherPeer ¶
func (tc *TestChannel) OtherPeer() peer.ID
OtherPeer returns the channel counter party peer
func (*TestChannel) Queued ¶
func (tc *TestChannel) Queued() uint64
Received returns the number of bytes received
func (*TestChannel) QueuedCidsTotal ¶
func (tc *TestChannel) QueuedCidsTotal() int64
func (*TestChannel) Received ¶
func (tc *TestChannel) Received() uint64
Received returns the number of bytes received
func (*TestChannel) ReceivedCids ¶
func (tc *TestChannel) ReceivedCids() []cid.Cid
ReceivedCids returns the cids received so far
func (*TestChannel) ReceivedCidsLen ¶
func (tc *TestChannel) ReceivedCidsLen() int
func (*TestChannel) ReceivedCidsTotal ¶
func (tc *TestChannel) ReceivedCidsTotal() int64
func (*TestChannel) Recipient ¶
func (tc *TestChannel) Recipient() peer.ID
Recipient returns the peer id for the node that is receiving data
func (*TestChannel) RequiresFinalization ¶
func (tc *TestChannel) RequiresFinalization() bool
func (*TestChannel) ResponderPaused ¶
func (tc *TestChannel) ResponderPaused() bool
func (*TestChannel) Selector ¶
func (tc *TestChannel) Selector() datamodel.Node
Selector returns the IPLD selector for this data transfer (represented as an IPLD node)
func (*TestChannel) SelfPaused ¶
func (tc *TestChannel) SelfPaused() bool
func (*TestChannel) SelfPeer ¶
func (tc *TestChannel) SelfPeer() peer.ID
SelfPeer returns the peer this channel belongs to
func (*TestChannel) Sender ¶
func (tc *TestChannel) Sender() peer.ID
Sender returns the peer id for the node that is sending data
func (*TestChannel) Sent ¶
func (tc *TestChannel) Sent() uint64
Sent returns the number of bytes sent
func (*TestChannel) SentCidsTotal ¶
func (tc *TestChannel) SentCidsTotal() int64
func (*TestChannel) Stages ¶
func (tc *TestChannel) Stages() *datatransfer.ChannelStages
func (*TestChannel) Status ¶
func (tc *TestChannel) Status() datatransfer.Status
Status is the current status of this channel
func (*TestChannel) TotalSize ¶
func (tc *TestChannel) TotalSize() uint64
TotalSize returns the total size for the data being transferred
func (*TestChannel) TransferID ¶
func (tc *TestChannel) TransferID() datatransfer.TransferID
TransferID returns the transfer id for this channel
func (*TestChannel) Voucher ¶
func (tc *TestChannel) Voucher() datatransfer.TypedVoucher
Voucher returns the voucher for this data transfer
func (*TestChannel) VoucherResults ¶
func (tc *TestChannel) VoucherResults() []datatransfer.TypedVoucher
VoucherResults are results of vouchers sent on the channel
func (*TestChannel) Vouchers ¶
func (tc *TestChannel) Vouchers() []datatransfer.TypedVoucher
Vouchers returns all vouchers sent on this channel
type TestChannelParams ¶
type TestChannelParams struct { TransferID datatransfer.TransferID BaseCID cid.Cid Selector datamodel.Node SelfPeer peer.ID Sender peer.ID Recipient peer.ID TotalSize uint64 IsPull bool Message string Sent uint64 Received uint64 Queued uint64 Status datatransfer.Status Vouchers []datatransfer.TypedVoucher VoucherResults []datatransfer.TypedVoucher ReceivedCids []cid.Cid }
TestChannelParams are params for a new test data transfer channel
type TestDataTransfer ¶
type TestDataTransfer struct { RegisteredVoucherTypes []RegisteredVoucherType RegisteredTransportConfigurers []RegisteredTransportConfigurer Subscribers []datatransfer.Subscriber }
TestDataTransfer is a mock implementation of the data transfer libary Most of its functions have no effect
func NewTestDataTransfer ¶
func NewTestDataTransfer() *TestDataTransfer
NewTestDataTransfer returns a new test interface implementation of datatransfer.Manager
func (*TestDataTransfer) ChannelState ¶
func (tdt *TestDataTransfer) ChannelState(ctx context.Context, chid datatransfer.ChannelID) (datatransfer.ChannelState, error)
func (*TestDataTransfer) CloseDataTransferChannel ¶
func (tdt *TestDataTransfer) CloseDataTransferChannel(ctx context.Context, chid datatransfer.ChannelID) error
CloseDataTransferChannel does nothing
func (*TestDataTransfer) InProgressChannels ¶
func (tdt *TestDataTransfer) InProgressChannels(ctx context.Context) (map[datatransfer.ChannelID]datatransfer.ChannelState, error)
InProgressChannels returns empty
func (*TestDataTransfer) OnReady ¶
func (tdt *TestDataTransfer) OnReady(f datatransfer.ReadyFunc)
func (*TestDataTransfer) OpenPullDataChannel ¶
func (tdt *TestDataTransfer) OpenPullDataChannel(ctx context.Context, to peer.ID, voucher datatransfer.TypedVoucher, baseCid cid.Cid, selector datamodel.Node, options ...datatransfer.TransferOption) (datatransfer.ChannelID, error)
OpenPullDataChannel does nothing
func (*TestDataTransfer) OpenPushDataChannel ¶
func (tdt *TestDataTransfer) OpenPushDataChannel(ctx context.Context, to peer.ID, voucher datatransfer.TypedVoucher, baseCid cid.Cid, selector datamodel.Node, options ...datatransfer.TransferOption) (datatransfer.ChannelID, error)
OpenPushDataChannel does nothing
func (*TestDataTransfer) PauseDataTransferChannel ¶
func (tdt *TestDataTransfer) PauseDataTransferChannel(ctx context.Context, chid datatransfer.ChannelID) error
PauseDataTransferChannel does nothing
func (*TestDataTransfer) RegisterTransportConfigurer ¶
func (tdt *TestDataTransfer) RegisterTransportConfigurer(voucherType datatransfer.TypeIdentifier, configurer datatransfer.TransportConfigurer) error
RegisterTransportConfigurer records the registered transport configurer
func (*TestDataTransfer) RegisterVoucherType ¶
func (tdt *TestDataTransfer) RegisterVoucherType(voucherType datatransfer.TypeIdentifier, validator datatransfer.RequestValidator) error
RegisterVoucherType records the registred voucher type
func (*TestDataTransfer) RestartDataTransferChannel ¶
func (tdt *TestDataTransfer) RestartDataTransferChannel(ctx context.Context, chId datatransfer.ChannelID) error
func (*TestDataTransfer) ResumeDataTransferChannel ¶
func (tdt *TestDataTransfer) ResumeDataTransferChannel(ctx context.Context, chid datatransfer.ChannelID) error
ResumeDataTransferChannel does nothing
func (*TestDataTransfer) SendVoucher ¶
func (tdt *TestDataTransfer) SendVoucher(ctx context.Context, chid datatransfer.ChannelID, voucher datatransfer.TypedVoucher) error
SendVoucher does nothing
func (*TestDataTransfer) SendVoucherResult ¶
func (tdt *TestDataTransfer) SendVoucherResult(ctx context.Context, chid datatransfer.ChannelID, voucherResult datatransfer.TypedVoucher) error
SendVoucherResult does nothing
func (*TestDataTransfer) Start ¶
func (tdt *TestDataTransfer) Start(ctx context.Context) error
Start does nothing
func (*TestDataTransfer) Stop ¶
func (tdt *TestDataTransfer) Stop(context.Context) error
Stop does nothing
func (*TestDataTransfer) SubscribeToEvents ¶
func (tdt *TestDataTransfer) SubscribeToEvents(subscriber datatransfer.Subscriber) datatransfer.Unsubscribe
SubscribeToEvents records subscribers
func (*TestDataTransfer) TransferChannelStatus ¶
func (tdt *TestDataTransfer) TransferChannelStatus(ctx context.Context, x datatransfer.ChannelID) datatransfer.Status
TransferChannelStatus returns ChannelNotFoundError
func (*TestDataTransfer) UpdateValidationStatus ¶
func (tdt *TestDataTransfer) UpdateValidationStatus(ctx context.Context, chid datatransfer.ChannelID, result datatransfer.ValidationResult) error
UpdateValidationStatus does nothing
type TestDealFunds ¶
type TestDealFunds struct { ReserveCalls []abi.TokenAmount ReleaseCalls []abi.TokenAmount // contains filtered or unexported fields }
func NewTestDealFunds ¶
func NewTestDealFunds() *TestDealFunds
func (*TestDealFunds) Get ¶
func (f *TestDealFunds) Get() abi.TokenAmount
func (*TestDealFunds) Release ¶
func (f *TestDealFunds) Release(amount abi.TokenAmount) (abi.TokenAmount, error)
func (*TestDealFunds) Reserve ¶
func (f *TestDealFunds) Reserve(amount abi.TokenAmount) (abi.TokenAmount, error)
type TestDealStreamParams ¶
type TestDealStreamParams struct { PeerID peer.ID ProposalReader DealProposalReader ProposalWriter DealProposalWriter ResponseReader DealResponseReader ResponseWriter DealResponseWriter PaymentReader DealPaymentReader PaymentWriter DealPaymentWriter }
TestDealStreamParams are parameters used to setup a TestRetrievalDealStream. All parameters except the peer ID are optional.
type TestFile ¶
TestFile is a mocked version of filestore.File with preset returns and a byte buffer for read/writes
func NewTestFile ¶
func NewTestFile(params TestFileParams) *TestFile
NewTestFile generates a mocked filestore.File that has programmed returns
type TestFileParams ¶
TestFileParams are parameters for a test file
type TestFileStore ¶
type TestFileStore struct {
// contains filtered or unexported fields
}
TestFileStore is a mocked file store that can provide programmed returns and test expectations
func NewTestFileStore ¶
func NewTestFileStore(params TestFileStoreParams) *TestFileStore
NewTestFileStore returns a new test file store from the given parameters
func (*TestFileStore) CreateTemp ¶
func (fs *TestFileStore) CreateTemp() (filestore.File, error)
CreateTemp will create a temporary file from the provided set of temporary files
func (*TestFileStore) Delete ¶
func (fs *TestFileStore) Delete(p filestore.Path) error
Delete will delete a file if it is in the file store
func (*TestFileStore) VerifyExpectations ¶
func (fs *TestFileStore) VerifyExpectations(t *testing.T)
VerifyExpectations will verify that the correct files were opened and deleted
type TestFileStoreParams ¶
type TestFileStoreParams struct { Files []filestore.File AvailableTempFiles []filestore.File ExpectedDeletions []filestore.Path ExpectedOpens []filestore.Path }
TestFileStoreParams are parameters for a test file store
type TestIPLDTree ¶
type TestIPLDTree struct { Storage map[datamodel.Link][]byte LeafAlpha datamodel.Node LeafAlphaLnk datamodel.Link LeafAlphaBlock blocks.Block LeafBeta datamodel.Node LeafBetaLnk datamodel.Link LeafBetaBlock blocks.Block MiddleMapNode datamodel.Node MiddleMapNodeLnk datamodel.Link MiddleMapBlock blocks.Block MiddleListNode datamodel.Node MiddleListNodeLnk datamodel.Link MiddleListBlock blocks.Block RootNode datamodel.Node RootNodeLnk datamodel.Link RootBlock blocks.Block }
TestIPLDTree is a set of IPLD Data that forms a tree spread across some blocks with a serialized in memory representation
func NewTestIPLDTree ¶
func NewTestIPLDTree() TestIPLDTree
NewTestIPLDTree returns a fake tree of nodes, spread across 5 blocks
type TestNetworkParams ¶
type TestNetworkParams struct { QueryStreamBuilder QueryStreamBuilder Receiver rmnet.RetrievalReceiver }
TestNetworkParams are parameters for setting up a test network. All parameters other than the receiver are optional
type TestPeerResolver ¶
type TestPeerResolver struct { Peers []rm.RetrievalPeer ResolverError error }
TestPeerResolver provides a fake retrievalmarket PeerResolver
func (TestPeerResolver) GetPeers ¶
func (tpr TestPeerResolver) GetPeers(cid.Cid) ([]rm.RetrievalPeer, error)
type TestPeerTagger ¶
func NewTestPeerTagger ¶
func NewTestPeerTagger() *TestPeerTagger
type TestPieceStore ¶
type TestPieceStore struct {
// contains filtered or unexported fields
}
TestPieceStore is piecestore who's query results are mocked
func NewTestPieceStore ¶
func NewTestPieceStore() *TestPieceStore
NewTestPieceStore creates a TestPieceStore
func NewTestPieceStoreWithParams ¶
func NewTestPieceStoreWithParams(params TestPieceStoreParams) *TestPieceStore
NewTestPieceStoreWithParams creates a TestPieceStore with the given parameters
func (*TestPieceStore) AddDealForPiece ¶
func (tps *TestPieceStore) AddDealForPiece(pieceCID cid.Cid, _ cid.Cid, dealInfo piecestore.DealInfo) error
AddDealForPiece returns a preprogrammed error
func (*TestPieceStore) AddPieceBlockLocations ¶
func (tps *TestPieceStore) AddPieceBlockLocations(pieceCID cid.Cid, blockLocations map[cid.Cid]piecestore.BlockLocation) error
AddPieceBlockLocations returns a preprogrammed error
func (*TestPieceStore) ExpectCID ¶
func (tps *TestPieceStore) ExpectCID(c cid.Cid, cidInfo piecestore.CIDInfo)
ExpectCID records a CID being expected to be queried and return the given CID info
func (*TestPieceStore) ExpectMissingCID ¶
func (tps *TestPieceStore) ExpectMissingCID(c cid.Cid)
ExpectMissingCID records a CID being expected to be queried and should fail
func (*TestPieceStore) ExpectMissingPiece ¶
func (tps *TestPieceStore) ExpectMissingPiece(pieceCid cid.Cid)
ExpectMissingPiece records a piece being expected to be queried and should fail
func (*TestPieceStore) ExpectPiece ¶
func (tps *TestPieceStore) ExpectPiece(pieceCid cid.Cid, pieceInfo piecestore.PieceInfo)
ExpectPiece records a piece being expected to be queried and return the given piece info
func (*TestPieceStore) GetCIDInfo ¶
func (tps *TestPieceStore) GetCIDInfo(c cid.Cid) (piecestore.CIDInfo, error)
GetCIDInfo returns cid info if it's been stubbed
func (*TestPieceStore) GetPieceInfo ¶
func (tps *TestPieceStore) GetPieceInfo(pieceCID cid.Cid) (piecestore.PieceInfo, error)
GetPieceInfo returns a piece info if it's been stubbed
func (*TestPieceStore) ListCidInfoKeys ¶
func (tps *TestPieceStore) ListCidInfoKeys() ([]cid.Cid, error)
func (*TestPieceStore) ListPieceInfoKeys ¶
func (tps *TestPieceStore) ListPieceInfoKeys() ([]cid.Cid, error)
func (*TestPieceStore) OnReady ¶
func (tps *TestPieceStore) OnReady(ready shared.ReadyFunc)
func (*TestPieceStore) ReturnErrorFromGetPieceInfo ¶
func (tps *TestPieceStore) ReturnErrorFromGetPieceInfo(err error)
func (*TestPieceStore) StubCID ¶
func (tps *TestPieceStore) StubCID(c cid.Cid, cidInfo piecestore.CIDInfo)
StubCID creates a return value for the given CID without expecting it to be called
func (*TestPieceStore) StubPiece ¶
func (tps *TestPieceStore) StubPiece(pieceCid cid.Cid, pieceInfo piecestore.PieceInfo)
StubPiece creates a return value for the given piece cid without expecting it to be called
func (*TestPieceStore) VerifyExpectations ¶
func (tps *TestPieceStore) VerifyExpectations(t *testing.T)
VerifyExpectations verifies that the piecestore was queried in the expected ways
type TestPieceStoreParams ¶
type TestPieceStoreParams struct { AddDealForPieceError error AddPieceBlockLocationsError error GetPieceInfoError error }
TestPieceStoreParams sets parameters for a piece store
type TestQueryStreamParams ¶
type TestQueryStreamParams struct { PeerID peer.ID Reader QueryReader RespReader QueryResponseReader RespWriter QueryResponseWriter Writer QueryWriter }
TestQueryStreamParams are parameters used to setup a TestRetrievalQueryStream. All parameters except the peer ID are optional.
type TestRetrievalBlockstoreAccessor ¶
type TestRetrievalBlockstoreAccessor struct {
Blockstore bstore.Blockstore
}
func NewTestRetrievalBlockstoreAccessor ¶
func NewTestRetrievalBlockstoreAccessor() *TestRetrievalBlockstoreAccessor
func (*TestRetrievalBlockstoreAccessor) Done ¶
func (t *TestRetrievalBlockstoreAccessor) Done(retrievalmarket.DealID) error
func (*TestRetrievalBlockstoreAccessor) Get ¶
func (t *TestRetrievalBlockstoreAccessor) Get(retrievalmarket.DealID, retrievalmarket.PayloadCID) (bstore.Blockstore, error)
type TestRetrievalDealStream ¶
type TestRetrievalDealStream struct {
// contains filtered or unexported fields
}
TestRetrievalDealStream is a retrieval deal stream with predefined stubbed behavior.
type TestRetrievalMarketNetwork ¶
type TestRetrievalMarketNetwork struct {
// contains filtered or unexported fields
}
TestRetrievalMarketNetwork is a test network that has stubbed behavior for testing the retrieval market implementation
func NewTestRetrievalMarketNetwork ¶
func NewTestRetrievalMarketNetwork(params TestNetworkParams) *TestRetrievalMarketNetwork
NewTestRetrievalMarketNetwork returns a new TestRetrievalMarketNetwork with the behavior specified by the paramaters, or default behaviors if not specified.
func (*TestRetrievalMarketNetwork) AddAddrs ¶
func (trmn *TestRetrievalMarketNetwork) AddAddrs(peer.ID, []ma.Multiaddr)
AddAddrs does nothing in test
func (*TestRetrievalMarketNetwork) ID ¶
func (trmn *TestRetrievalMarketNetwork) ID() peer.ID
ID returns the peer id of this host (empty peer ID in test)
func (*TestRetrievalMarketNetwork) NewQueryStream ¶
func (trmn *TestRetrievalMarketNetwork) NewQueryStream(id peer.ID) (rmnet.RetrievalQueryStream, error)
NewDealStatusStream returns a query stream. Note this always returns the same stream. This is fine for testing for now.
func (*TestRetrievalMarketNetwork) ReceiveQueryStream ¶
func (trmn *TestRetrievalMarketNetwork) ReceiveQueryStream(qs rmnet.RetrievalQueryStream)
ReceiveQueryStream simulates receiving a query stream
func (*TestRetrievalMarketNetwork) SetDelegate ¶
func (trmn *TestRetrievalMarketNetwork) SetDelegate(r rmnet.RetrievalReceiver) error
SetDelegate sets the market receiver
func (*TestRetrievalMarketNetwork) StopHandlingRequests ¶
func (trmn *TestRetrievalMarketNetwork) StopHandlingRequests() error
StopHandlingRequests sets receiver to nil
type TestRetrievalQueryStream ¶
type TestRetrievalQueryStream struct {
// contains filtered or unexported fields
}
TestRetrievalQueryStream is a retrieval query stream with predefined stubbed behavior.
func NewTestRetrievalQueryStream ¶
func NewTestRetrievalQueryStream(params TestQueryStreamParams) *TestRetrievalQueryStream
NewTestRetrievalQueryStream returns a new TestRetrievalQueryStream with the behavior specified by the paramaters, or default behaviors if not specified.
func (*TestRetrievalQueryStream) Close ¶
func (trqs *TestRetrievalQueryStream) Close() error
Close closes the stream (does nothing for test).
func (*TestRetrievalQueryStream) ReadQuery ¶
func (trqs *TestRetrievalQueryStream) ReadQuery() (rm.Query, error)
ReadDealStatusRequest calls the mocked query reader.
func (*TestRetrievalQueryStream) ReadQueryResponse ¶
func (trqs *TestRetrievalQueryStream) ReadQueryResponse() (rm.QueryResponse, error)
ReadDealStatusResponse calls the mocked query response reader.
func (*TestRetrievalQueryStream) RemotePeer ¶
func (trqs *TestRetrievalQueryStream) RemotePeer() peer.ID
func (*TestRetrievalQueryStream) SetRemotePeer ¶
func (trqs *TestRetrievalQueryStream) SetRemotePeer(rp peer.ID)
func (*TestRetrievalQueryStream) WriteQuery ¶
func (trqs *TestRetrievalQueryStream) WriteQuery(newQuery rm.Query) error
WriteDealStatusRequest calls the mocked query writer.
func (*TestRetrievalQueryStream) WriteQueryResponse ¶
func (trqs *TestRetrievalQueryStream) WriteQueryResponse(newResp rm.QueryResponse) error
WriteDealStatusResponse calls the mocked query response writer.
type TestStorageBlockstoreAccessor ¶
type TestStorageBlockstoreAccessor struct {
Blockstore bstore.Blockstore
}
func NewTestStorageBlockstoreAccessor ¶
func NewTestStorageBlockstoreAccessor() *TestStorageBlockstoreAccessor
func (*TestStorageBlockstoreAccessor) Done ¶
func (t *TestStorageBlockstoreAccessor) Done(storagemarket.PayloadCID) error
func (*TestStorageBlockstoreAccessor) Get ¶
func (t *TestStorageBlockstoreAccessor) Get(storagemarket.PayloadCID) (bstore.Blockstore, error)
type TestStorageDealStream ¶
type TestStorageDealStream struct { CloseCount int CloseError error // contains filtered or unexported fields }
TestStorageDealStream is a retrieval deal stream with predefined stubbed behavior.
func NewTestStorageDealStream ¶
func NewTestStorageDealStream(params TestStorageDealStreamParams) *TestStorageDealStream
NewTestStorageDealStream returns a new TestStorageDealStream with the behavior specified by the paramaters, or default behaviors if not specified.
func (*TestStorageDealStream) Close ¶
func (tsds *TestStorageDealStream) Close() error
Close closes the stream (does nothing for mocked stream)
func (*TestStorageDealStream) ReadDealProposal ¶
func (tsds *TestStorageDealStream) ReadDealProposal() (smnet.Proposal, error)
ReadDealProposal calls the mocked deal proposal reader function.
func (*TestStorageDealStream) ReadDealResponse ¶
func (tsds *TestStorageDealStream) ReadDealResponse() (smnet.SignedResponse, []byte, error)
ReadDealResponse calls the mocked deal response reader function.
func (TestStorageDealStream) RemotePeer ¶
func (tsds TestStorageDealStream) RemotePeer() peer.ID
RemotePeer returns the other peer
func (*TestStorageDealStream) WriteDealProposal ¶
func (tsds *TestStorageDealStream) WriteDealProposal(dealProposal smnet.Proposal) error
WriteDealProposal calls the mocked deal proposal writer function.
func (*TestStorageDealStream) WriteDealResponse ¶
func (tsds *TestStorageDealStream) WriteDealResponse(dealResponse smnet.SignedResponse, resigningFunc smnet.ResigningFunc) error
WriteDealResponse calls the mocked deal response writer function.
type TestStorageDealStreamParams ¶
type TestStorageDealStreamParams struct { PeerID peer.ID ProposalReader StorageDealProposalReader ProposalWriter StorageDealProposalWriter ResponseReader StorageDealResponseReader ResponseWriter StorageDealResponseWriter }
TestStorageDealStreamParams are parameters used to setup a TestStorageDealStream. All parameters except the peer ID are optional.