types

package module
v0.0.0-...-10833ce Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0, MIT Imports: 3 Imported by: 1

Documentation

Overview

This sub-module contains complete, dependency-free definitions of all possible responses of the EGD API. This includes the "root" ResponseEnvelope struct and all of its dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIErrorCode

type APIErrorCode int //nolint:revive
const (
	ErrOversizedPiece                  APIErrorCode = 4011
	ErrStorageProviderSuspended        APIErrorCode = 4012
	ErrStorageProviderIneligibleToMine APIErrorCode = 4013

	ErrStorageProviderInfoTooOld APIErrorCode = 4041
	ErrStorageProviderUndialable APIErrorCode = 4042

	ErrUnclaimedPieceCID         APIErrorCode = 4020
	ErrProviderHasReplica        APIErrorCode = 4021
	ErrTenantsOutOfDatacap       APIErrorCode = 4022
	ErrTooManyReplicas           APIErrorCode = 4023
	ErrProviderAboveMaxInFlight  APIErrorCode = 4024
	ErrReplicationRulesViolation APIErrorCode = 4029 // catch-all for when there is no common rejection theme for competing tenants

	ErrExternalReservationRefused APIErrorCode = 4030 // some tenants are looking to add an additional check on their end
)
const (
	ErrInvalidRequest            APIErrorCode = 4400
	ErrUnauthorizedAccess        APIErrorCode = 4401
	ErrSystemTemporarilyDisabled APIErrorCode = 4503
)

func (APIErrorCode) String

func (i APIErrorCode) String() string

type DataSource

type DataSource interface {
	SrcType() string
}

type DealProposal

type DealProposal struct {
	ProposalID     string       `json:"deal_proposal_id"`
	ProposalCid    *string      `json:"deal_proposal_cid,omitempty"`
	HoursRemaining int          `json:"hours_remaining"`
	PieceSize      int64        `json:"piece_size"`
	PieceCid       string       `json:"piece_cid"`
	TenantID       int16        `json:"tenant_id"`
	TenantClient   string       `json:"tenant_client_id"`
	StartTime      time.Time    `json:"deal_start_time"`
	StartEpoch     int64        `json:"deal_start_epoch"`
	ImportCmd      string       `json:"sample_import_cmd"`
	Sources        []DataSource `json:"sources,omitempty"`
}

type FilSourceDAG

type FilSourceDAG struct {
	SourceType string `json:"source_type"`

	// fil specific
	DealID             int64      `json:"deal_id"`
	ProviderID         string     `json:"provider_id"`
	OriginalPayloadCid string     `json:"original_payload_cid"`
	DealExpiration     time.Time  `json:"deal_expiration"`
	IsFilplus          bool       `json:"is_filplus"`
	SectorID           *string    `json:"sector_id,omitempty"`
	SectorExpiration   *time.Time `json:"sector_expiration,omitempty"`
	SampleRetrieveCmd  string     `json:"sample_retrieve_cmd"`
}

FilSourceDAG represents an item retrievable from the Fil Network using a block-transport protocol like Graphsync. Whenever possible users of the SPADE API should default to alternative sources offering stream-protocols.

func (*FilSourceDAG) InitDerivedVals

func (s *FilSourceDAG) InitDerivedVals(pieceCid string) error

func (*FilSourceDAG) SrcType

func (s *FilSourceDAG) SrcType() string

type Piece

type Piece struct {
	PieceCid         string       `json:"piece_cid"`
	PaddedPieceSize  uint64       `json:"padded_piece_size"`
	ClaimingTenants  []int16      `json:"tenants" db:"tenant_ids"`
	SampleRequestCmd string       `json:"sample_request_cmd"`
	Sources          []DataSource `json:"sources,omitempty"`
}

type ProposalFailure

type ProposalFailure struct {
	ErrorTimeStamp time.Time `json:"timestamp"`
	Error          string    `json:"error"`
	PieceCid       string    `json:"piece_cid"`
	ProposalID     string    `json:"deal_proposal_id"`
	ProposalCid    *string   `json:"deal_proposal_cid,omitempty"`
	TenantID       int16     `json:"tenant_id"`
	TenantClient   string    `json:"tenant_client_id"`
}

type ResponseDealRequest

type ResponseDealRequest struct {
	ReplicationStates []TenantReplicationState `json:"tenant_replication_states"`
	DealStartTime     *time.Time               `json:"deal_start_time,omitempty"`
	DealStartEpoch    *int64                   `json:"deal_start_epoch,omitempty"`
}

ResponseDealRequest is the response payload returned by the .../sp/request_piece/{{PieceCid}} endpoint

type ResponseEnvelope

type ResponseEnvelope struct {
	RequestID          string          `json:"request_id,omitempty"`
	ResponseTime       time.Time       `json:"response_timestamp"`
	ResponseStateEpoch int64           `json:"response_state_epoch,omitempty"`
	ResponseCode       int             `json:"response_code"`
	ErrCode            int             `json:"error_code,omitempty"`
	ErrSlug            string          `json:"error_slug,omitempty"`
	ErrLines           []string        `json:"error_lines,omitempty"`
	InfoLines          []string        `json:"info_lines,omitempty"`
	ResponseEntries    *int            `json:"response_entries,omitempty"`
	Response           ResponsePayload `json:"response"`
}

ResponseEnvelope is the structure wrapping all responses from the deal engine

type ResponsePayload

type ResponsePayload interface {
	// contains filtered or unexported methods
}

type ResponsePendingProposals

type ResponsePendingProposals struct {
	RecentFailures   []ProposalFailure `json:"recent_failures,omitempty"`
	PendingProposals []DealProposal    `json:"pending_proposals"`
}

ResponsePendingProposals is the response payload returned by the .../sp/pending_proposals endpoint

type ResponsePiecesEligible

type ResponsePiecesEligible []*Piece

ResponsePiecesEligible is the response payload returned by the .../sp/eligible_pieces endpoint

type SPInfo

type SPInfo struct {
	Errors             []string            `json:"errors,omitempty"`
	SectorLog2Size     uint8               `json:"sector_log2_size"`
	PeerID             *string             `json:"peerid"`
	MultiAddrs         []string            `json:"multiaddrs"`
	RetrievalProtocols map[string][]string `json:"retrieval_protocols,omitempty"`
	PeerInfo           *struct {
		Protos map[string]struct{}    `json:"libp2p_protocols"`
		Meta   map[string]interface{} `json:"meta"`
	} `json:"peer_info,omitempty"`
}

type TenantReplicationState

type TenantReplicationState struct {
	TenantID     int16   `json:"tenant_id"`
	TenantClient *string `json:"tenant_client_id"`

	MaxInFlightBytes int64 `json:"tenant_max_in_flight_bytes"`
	SpInFlightBytes  int64 `json:"actual_in_flight_bytes" db:"cur_in_flight_bytes"`

	MaxTotal     int16 `json:"tenant_max_total"`
	MaxOrg       int16 `json:"tenant_max_per_org"         db:"max_per_org"`
	MaxCity      int16 `json:"tenant_max_per_city"        db:"max_per_city"`
	MaxCountry   int16 `json:"tenant_max_per_country"     db:"max_per_country"`
	MaxContinent int16 `json:"tenant_max_per_continent"   db:"max_per_continent"`

	Total       int16 `json:"actual_total"                db:"cur_total"`
	InOrg       int16 `json:"actual_within_org"           db:"cur_in_org"`
	InCity      int16 `json:"actual_within_city"          db:"cur_in_city"`
	InCountry   int16 `json:"actual_within_country"       db:"cur_in_country"`
	InContinent int16 `json:"actual_within_continent"     db:"cur_in_continent"`

	DealAlreadyExists bool `json:"sp_holds_qualifying_deal"`
}

Jump to

Keyboard shortcuts

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