requestvalidation

package
v1.28.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2023 License: Apache-2.0, MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) Subscribe added in v1.25.1

func (*ProviderRequestValidator) ValidatePull

func (rv *ProviderRequestValidator) ValidatePull(_ datatransfer.ChannelID, receiver peer.ID, voucher datamodel.Node, baseCid cid.Cid, selector datamodel.Node) (datatransfer.ValidationResult, error)

ValidatePull validates a pull request received from the peer that will receive data

func (*ProviderRequestValidator) ValidatePush

func (rv *ProviderRequestValidator) ValidatePush(_ datatransfer.ChannelID, sender peer.ID, voucher datamodel.Node, baseCid cid.Cid, selector datamodel.Node) (datatransfer.ValidationResult, error)

ValidatePush validates a push request received from the peer that will send data

func (*ProviderRequestValidator) ValidateRestart added in v1.28.0

ValidateRestart validates a request on restart, based on its current state

type ValidationEnvironment

type ValidationEnvironment interface {
	GetAsk(ctx context.Context, payloadCid cid.Cid, pieceCid *cid.Cid, piece piecestore.PieceInfo, isUnsealed bool, client peer.ID) (rm.Ask, error)

	GetPiece(c cid.Cid, pieceCID *cid.Cid) (piecestore.PieceInfo, bool, error)
	// CheckDealParams verifies the given deal params are acceptable
	CheckDealParams(ask rm.Ask, 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 rm.ProviderDealState) (bool, string, error)
	// StateMachines returns the FSM Group to begin tracking with
	BeginTracking(pds rm.ProviderDealState) error
	Get(dealID rm.ProviderDealIdentifier) (rm.ProviderDealState, error)
}

ValidationEnvironment contains the dependencies needed to validate deals

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL