Documentation ¶
Index ¶
- func NewLegacyRevalidator(providerRevalidator *ProviderRevalidator) datatransfer.Revalidator
- type ProviderRequestValidator
- func (rv *ProviderRequestValidator) ValidatePull(receiver peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, ...) (datatransfer.VoucherResult, error)
- func (rv *ProviderRequestValidator) ValidatePush(sender peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, ...) (datatransfer.VoucherResult, error)
- type ProviderRevalidator
- func (pr *ProviderRevalidator) OnComplete(chid datatransfer.ChannelID) (bool, datatransfer.VoucherResult, error)
- func (pr *ProviderRevalidator) OnPullDataSent(chid datatransfer.ChannelID, additionalBytesSent uint64) (bool, datatransfer.VoucherResult, error)
- func (pr *ProviderRevalidator) OnPushDataReceived(chid datatransfer.ChannelID, additionalBytesReceived uint64) (bool, datatransfer.VoucherResult, error)
- func (pr *ProviderRevalidator) Revalidate(channelID datatransfer.ChannelID, voucher datatransfer.Voucher) (datatransfer.VoucherResult, error)
- func (pr *ProviderRevalidator) TrackChannel(deal rm.ProviderDealState)
- func (pr *ProviderRevalidator) UntrackChannel(deal rm.ProviderDealState)
- type RevalidatorEnvironment
- type ValidationEnvironment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLegacyRevalidator ¶
func NewLegacyRevalidator(providerRevalidator *ProviderRevalidator) datatransfer.Revalidator
NewLegacyRevalidator adds a revalidator that will capture revalidation requests for the legacy protocol but won't double count data being sent TODO: the data transfer revalidator registration needs to be able to take multiple types to avoid double counting for data being sent.
Types ¶
type ProviderRequestValidator ¶
type ProviderRequestValidator struct {
// contains filtered or unexported fields
}
ProviderRequestValidator validates incoming requests for the Retrieval Provider
func NewProviderRequestValidator ¶
func NewProviderRequestValidator(env ValidationEnvironment) *ProviderRequestValidator
NewProviderRequestValidator returns a new instance of the ProviderRequestValidator
func (*ProviderRequestValidator) ValidatePull ¶
func (rv *ProviderRequestValidator) ValidatePull(receiver peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, selector ipld.Node) (datatransfer.VoucherResult, error)
ValidatePull validates a pull request received from the peer that will receive data
func (*ProviderRequestValidator) ValidatePush ¶
func (rv *ProviderRequestValidator) ValidatePush(sender peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, selector ipld.Node) (datatransfer.VoucherResult, error)
ValidatePush validates a push request received from the peer that will send data
type ProviderRevalidator ¶
type ProviderRevalidator struct {
// contains filtered or unexported fields
}
ProviderRevalidator defines data transfer revalidation logic in the context of a provider for a retrieval deal
func NewProviderRevalidator ¶
func NewProviderRevalidator(env RevalidatorEnvironment) *ProviderRevalidator
NewProviderRevalidator returns a new instance of a ProviderRevalidator
func (*ProviderRevalidator) OnComplete ¶
func (pr *ProviderRevalidator) OnComplete(chid datatransfer.ChannelID) (bool, datatransfer.VoucherResult, error)
OnComplete is called to make a final request for revalidation -- often for the purpose of settlement. if VoucherResult is non nil, the request will enter a settlement phase awaiting a final update
func (*ProviderRevalidator) OnPullDataSent ¶
func (pr *ProviderRevalidator) OnPullDataSent(chid datatransfer.ChannelID, additionalBytesSent uint64) (bool, datatransfer.VoucherResult, error)
OnPullDataSent is called on the responder side when more bytes are sent for a given pull request. It should return a VoucherResult + ErrPause to request revalidation or nil to continue uninterrupted, other errors will terminate the request
func (*ProviderRevalidator) OnPushDataReceived ¶
func (pr *ProviderRevalidator) OnPushDataReceived(chid datatransfer.ChannelID, additionalBytesReceived uint64) (bool, datatransfer.VoucherResult, error)
OnPushDataReceived is called on the responder side when more bytes are received for a given push request. It should return a VoucherResult + ErrPause to request revalidation or nil to continue uninterrupted, other errors will terminate the request
func (*ProviderRevalidator) Revalidate ¶
func (pr *ProviderRevalidator) Revalidate(channelID datatransfer.ChannelID, voucher datatransfer.Voucher) (datatransfer.VoucherResult, error)
Revalidate revalidates a request with a new voucher
func (*ProviderRevalidator) TrackChannel ¶
func (pr *ProviderRevalidator) TrackChannel(deal rm.ProviderDealState)
TrackChannel indicates a retrieval deal tracked by this provider. It associates a given channel ID with a retrieval deal, so that checks run for data sent on the channel
func (*ProviderRevalidator) UntrackChannel ¶
func (pr *ProviderRevalidator) UntrackChannel(deal rm.ProviderDealState)
UntrackChannel indicates a retrieval deal is finish and no longer is tracked by this provider
type RevalidatorEnvironment ¶
type RevalidatorEnvironment interface { Node() rm.RetrievalProviderNode SendEvent(dealID rm.ProviderDealIdentifier, evt rm.ProviderEvent, args ...interface{}) error Get(dealID rm.ProviderDealIdentifier) (rm.ProviderDealState, error) }
RevalidatorEnvironment are the dependencies needed to build the logic of revalidation -- essentially, access to the node at statemachines
type ValidationEnvironment ¶
type ValidationEnvironment interface { GetPiece(c cid.Cid, pieceCID *cid.Cid) (piecestore.PieceInfo, error) // CheckDealParams verifies the given deal params are acceptable CheckDealParams(pricePerByte abi.TokenAmount, paymentInterval uint64, paymentIntervalIncrease uint64, unsealPrice abi.TokenAmount) error // RunDealDecisioningLogic runs custom deal decision logic to decide if a deal is accepted, if present RunDealDecisioningLogic(ctx context.Context, state retrievalmarket.ProviderDealState) (bool, string, error) // StateMachines returns the FSM Group to begin tracking with BeginTracking(pds retrievalmarket.ProviderDealState) error // NextStoreID allocates a store for this deal NextStoreID() (multistore.StoreID, error) }
ValidationEnvironment contains the dependencies needed to validate deals