Documentation
¶
Index ¶
- type TestRetrievalClientNode
- func (trcn *TestRetrievalClientNode) AllocateLane(paymentChannel address.Address) (uint64, error)
- func (trcn *TestRetrievalClientNode) CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, ...) (*paych.SignedVoucher, error)
- func (trcn *TestRetrievalClientNode) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error)
- func (trcn *TestRetrievalClientNode) GetOrCreatePaymentChannel(ctx context.Context, clientAddress address.Address, ...) (address.Address, cid.Cid, error)
- func (trcn *TestRetrievalClientNode) WaitForPaymentChannelAddFunds(messageCID cid.Cid) error
- func (trcn *TestRetrievalClientNode) WaitForPaymentChannelCreation(messageCID cid.Cid) (address.Address, error)
- type TestRetrievalClientNodeParams
- type TestRetrievalProviderNode
- func (trpn *TestRetrievalProviderNode) ExpectFailedUnseal(sectorID uint64, offset uint64, length uint64)
- func (trpn *TestRetrievalProviderNode) ExpectUnseal(sectorID uint64, offset uint64, length uint64, data []byte)
- func (trpn *TestRetrievalProviderNode) ExpectVoucher(paymentChannel address.Address, voucher *paych.SignedVoucher, proof []byte, ...) error
- func (trpn *TestRetrievalProviderNode) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error)
- func (trpn *TestRetrievalProviderNode) GetMinerWorkerAddress(ctx context.Context, addr address.Address, tok shared.TipSetToken) (address.Address, error)
- func (trpn *TestRetrievalProviderNode) SavePaymentVoucher(ctx context.Context, paymentChannel address.Address, ...) (abi.TokenAmount, error)
- func (trpn *TestRetrievalProviderNode) StubUnseal(sectorID uint64, offset uint64, length uint64, data []byte)
- func (trpn *TestRetrievalProviderNode) UnsealSector(ctx context.Context, sectorID uint64, offset uint64, length uint64) (io.ReadCloser, error)
- func (trpn *TestRetrievalProviderNode) VerifyExpectations(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestRetrievalClientNode ¶
type TestRetrievalClientNode struct {
// contains filtered or unexported fields
}
TestRetrievalClientNode is a node adapter for a retrieval client whose responses are stubbed
func NewTestRetrievalClientNode ¶
func NewTestRetrievalClientNode(params TestRetrievalClientNodeParams) *TestRetrievalClientNode
NewTestRetrievalClientNode initializes a new TestRetrievalClientNode based on the given params
func (*TestRetrievalClientNode) AllocateLane ¶
func (trcn *TestRetrievalClientNode) AllocateLane(paymentChannel address.Address) (uint64, error)
AllocateLane creates a mock lane on a payment channel
func (*TestRetrievalClientNode) CreatePaymentVoucher ¶
func (trcn *TestRetrievalClientNode) CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, lane uint64, tok shared.TipSetToken) (*paych.SignedVoucher, error)
CreatePaymentVoucher creates a mock payment voucher based on a channel and lane
func (*TestRetrievalClientNode) GetChainHead ¶
func (trcn *TestRetrievalClientNode) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error)
func (*TestRetrievalClientNode) GetOrCreatePaymentChannel ¶
func (trcn *TestRetrievalClientNode) GetOrCreatePaymentChannel(ctx context.Context, clientAddress address.Address, minerAddress address.Address, clientFundsAvailable abi.TokenAmount, tok shared.TipSetToken) (address.Address, cid.Cid, error)
GetOrCreatePaymentChannel returns a mocked payment channel
func (*TestRetrievalClientNode) WaitForPaymentChannelAddFunds ¶
func (trcn *TestRetrievalClientNode) WaitForPaymentChannelAddFunds(messageCID cid.Cid) error
func (*TestRetrievalClientNode) WaitForPaymentChannelCreation ¶
func (trcn *TestRetrievalClientNode) WaitForPaymentChannelCreation(messageCID cid.Cid) (address.Address, error)
type TestRetrievalClientNodeParams ¶
type TestRetrievalClientNodeParams struct { PayCh address.Address PayChErr error CreatePaychCID, AddFundsCID cid.Cid Lane uint64 LaneError error Voucher *paych.SignedVoucher VoucherError error AllocateLaneRecorder func(address.Address) PaymentVoucherRecorder func(voucher *paych.SignedVoucher) PaymentChannelRecorder func(address.Address, address.Address, abi.TokenAmount) AddFundsOnly bool WaitForAddFundsErr, WaitForChCreateErr error }
TestRetrievalClientNodeParams are parameters for initializing a TestRetrievalClientNode
type TestRetrievalProviderNode ¶
type TestRetrievalProviderNode struct {
// contains filtered or unexported fields
}
TestRetrievalProviderNode is a node adapter for a retrieval provider whose responses are mocked
func NewTestRetrievalProviderNode ¶
func NewTestRetrievalProviderNode() *TestRetrievalProviderNode
NewTestRetrievalProviderNode instantiates a new TestRetrievalProviderNode
func (*TestRetrievalProviderNode) ExpectFailedUnseal ¶
func (trpn *TestRetrievalProviderNode) ExpectFailedUnseal(sectorID uint64, offset uint64, length uint64)
ExpectFailedUnseal indicates an expectation that a call will be made to unseal a sector with the given params and should fail
func (*TestRetrievalProviderNode) ExpectUnseal ¶
func (trpn *TestRetrievalProviderNode) ExpectUnseal(sectorID uint64, offset uint64, length uint64, data []byte)
ExpectUnseal indicates an expectation that a call will be made to unseal a sector with the given params and should return the given data
func (*TestRetrievalProviderNode) ExpectVoucher ¶
func (trpn *TestRetrievalProviderNode) ExpectVoucher( paymentChannel address.Address, voucher *paych.SignedVoucher, proof []byte, expectedAmount abi.TokenAmount, actualAmount abi.TokenAmount, expectedErr error) error
ExpectVoucher sets a voucher to be expected by SavePaymentVoucher
paymentChannel: the address of the payment channel the client creates voucher: the voucher to match proof: the proof to use (can be blank) expectedAmount: the expected tokenamount for this voucher actualAmount: the actual amount to use. use same as expectedAmount unless you want to trigger an error expectedErr: an error message to expect
func (*TestRetrievalProviderNode) GetChainHead ¶
func (trpn *TestRetrievalProviderNode) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error)
func (*TestRetrievalProviderNode) GetMinerWorkerAddress ¶
func (trpn *TestRetrievalProviderNode) GetMinerWorkerAddress(ctx context.Context, addr address.Address, tok shared.TipSetToken) (address.Address, error)
GetMinerWorker translates an address
func (*TestRetrievalProviderNode) SavePaymentVoucher ¶
func (trpn *TestRetrievalProviderNode) SavePaymentVoucher( ctx context.Context, paymentChannel address.Address, voucher *paych.SignedVoucher, proof []byte, expectedAmount abi.TokenAmount, tok shared.TipSetToken) (abi.TokenAmount, error)
SavePaymentVoucher simulates saving a payment voucher with a stubbed result
func (*TestRetrievalProviderNode) StubUnseal ¶
func (trpn *TestRetrievalProviderNode) StubUnseal(sectorID uint64, offset uint64, length uint64, data []byte)
StubUnseal stubs a response to attempting to unseal a sector with the given paramters
func (*TestRetrievalProviderNode) UnsealSector ¶
func (trpn *TestRetrievalProviderNode) UnsealSector(ctx context.Context, sectorID uint64, offset uint64, length uint64) (io.ReadCloser, error)
UnsealSector simulates unsealing a sector by returning a stubbed response or erroring
func (*TestRetrievalProviderNode) VerifyExpectations ¶
func (trpn *TestRetrievalProviderNode) VerifyExpectations(t *testing.T)
VerifyExpectations verifies that all expected calls were made and no other calls were made