Documentation
¶
Index ¶
- Constants
- type API
- type AllocatedPiece
- type CalculateCommPResponse
- type Error
- type GetProviderStatusResults
- type Kind
- type ParkPieceRequest
- type Piece
- type PieceAPI
- type PieceAllocation
- type PieceCommPAPI
- type PieceReader
- type PieceReaderAPI
- type PieceResolverAPI
- type PieceUpload
- type PieceWriterAPI
- type ProofSet
- type ProofSetAPI
- type ProofSetContractState
- type ProofSetIDProvider
- type ProofSetState
- type ProofSetStatus
- type ProviderAPI
- type Range
- type ReadPieceConfig
- type ReadPieceOption
- type RegisterProviderParams
- type RegisterProviderResults
- type RootAdd
- type RootEntry
Constants ¶
View Source
const (
ProductTypePDP uint8 = 0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
ProofSetAPI
PieceAPI
ProviderAPI
}
type AllocatedPiece ¶
func (AllocatedPiece) MarshalLogObject ¶
func (a AllocatedPiece) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for AllocatedPiece
type CalculateCommPResponse ¶ added in v0.0.18
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents a service error with a kind
type GetProviderStatusResults ¶ added in v0.0.17
type GetProviderStatusResults struct {
// ID of provider (0 if not registered)
ID uint64
// address of the provider
Address common.Address
// address the provider will receive payment on
Payee common.Address
// True if the provider is registered in the registry
IsRegistered bool
// True if the provider is active
IsActive bool
// Optional name chosen by provider
Name string
// Optional description chosen by provider
Description string
// Registration status: "not_registered", "pending", or "registered"
RegistrationStatus string
// True if contract operator approved provider to operate
IsApproved bool
}
type ParkPieceRequest ¶ added in v0.0.18
type Piece ¶
type Piece struct {
// Name of the hash function used
// sha2-256-trunc254-padded - CommP
// sha2-256 - Blob sha256
Name string
// hex encoded hash
Hash multihash.Multihash
// Size of the piece in bytes
Size int64
}
func (Piece) MarshalLogObject ¶
func (p Piece) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for Piece
type PieceAPI ¶
type PieceAPI interface {
PieceReaderAPI
PieceResolverAPI
PieceWriterAPI
PieceCommPAPI
// ParkPiece persists a record of a commp cid to the database
ParkPiece(ctx context.Context, params ParkPieceRequest) error
// WritePieceURL returns the URL an allocated blob may be uploaded to.
WritePieceURL(blob uuid.UUID) (url.URL, error)
// ReadPieceURL returns the URL a blob may be retrieved from.
ReadPieceURL(blob cid.Cid) (url.URL, error)
}
type PieceAllocation ¶
func (PieceAllocation) MarshalLogObject ¶
func (p PieceAllocation) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for PieceAllocation
type PieceCommPAPI ¶ added in v0.0.18
type PieceReader ¶
type PieceReader struct {
// Size is the total size of the piece
Size int64
Data io.ReadCloser
}
func (PieceReader) MarshalLogObject ¶
func (p PieceReader) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for PieceReader
type PieceReaderAPI ¶ added in v0.0.18
type PieceReaderAPI interface {
// Read returns a `PieceReader` for the provided `data` multihash. An error is returned if the value doesn't exist,
// of if reading from the store fails. `ReadPieceOption`s may be provided for range queries and resolution before read.
// Read expects `data` to be the multihash the data was uploaded with. If callers provide a commP multihash to Read
// they must also provide a resolver method for the operation to succeed, this will almost always be the ResoleToBlob
// resolver.
Read(ctx context.Context, data multihash.Multihash, options ...ReadPieceOption) (*PieceReader, error)
// Has returns true if the provided `data` multihash is present in the store, false otherwise
Has(ctx context.Context, blob multihash.Multihash) (bool, error)
}
type PieceResolverAPI ¶ added in v0.0.18
type PieceResolverAPI interface {
// Resolve accepts any multihash and attempts to resolve it to its corresponding hash.
// For example, if the provided hash is a commp multihash the blob hash will be returned.
// if the provided hash is not a commp multihash the commp hash will be returned.
// false if returned if data doesn't exist.
Resolve(ctx context.Context, data multihash.Multihash) (multihash.Multihash, bool, error)
// ResolveToPiece accepts a non-commp multihash and returns the commp multihash it corresponds to.
// If the multihash doesn't exist false is returned without an error.
ResolveToPiece(ctx context.Context, blob multihash.Multihash) (multihash.Multihash, bool, error)
// ResolveToBlob accepts a commp multihash and returns the blob multihash it corresponds to.
// If the commp multihash doesn't exist false is returned without an error.
ResolveToBlob(ctx context.Context, piece multihash.Multihash) (multihash.Multihash, bool, error)
}
type PieceUpload ¶
func (PieceUpload) MarshalLogObject ¶
func (p PieceUpload) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for PieceUpload
type PieceWriterAPI ¶ added in v0.0.18
type PieceWriterAPI interface {
AllocatePiece(ctx context.Context, allocation PieceAllocation) (*AllocatedPiece, error)
UploadPiece(ctx context.Context, upload PieceUpload) error
}
type ProofSet ¶
type ProofSet struct {
ID uint64
Initialized bool
NextChallengeEpoch int64
PreviousChallengeEpoch int64
ProvingPeriod int64
ChallengeWindow int64
Roots []RootEntry
}
func (ProofSet) MarshalLogObject ¶
func (p ProofSet) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for ProofSet
type ProofSetAPI ¶
type ProofSetAPI interface {
CreateProofSet(ctx context.Context) (common.Hash, error)
GetProofSetStatus(ctx context.Context, txHash common.Hash) (*ProofSetStatus, error)
GetProofSet(ctx context.Context, proofSetID uint64) (*ProofSet, error)
AddRoots(ctx context.Context, proofSetID uint64, roots []RootAdd) (common.Hash, error)
RemoveRoot(ctx context.Context, proofSetID uint64, rootID uint64) (common.Hash, error)
}
type ProofSetContractState ¶ added in v0.0.15
type ProofSetContractState struct {
// owners of the proof set
Owners []common.Address
// The start of the NEXT OPEN proving period's challenge window
NextChallengeWindowStart uint64
// the epoch of the next challenge
NextChallengeEpoch uint64
// Max number of epochs between two consecutive proofs
MaxProvingPeriod uint64
// challengeWindow Number of epochs for the challenge window
ChallengeWindow uint64
//index of the most recently added leaf that is challengeable in the current proving period
ChallengeRange uint64
// piece ids of the pieces scheduled for removal at the start of the next proving period
ScheduledRemovals []uint64
// estimated cost of submitting a proof
ProofFee uint64
// estimated cost of submitting a proof with buffer applied
ProofFeeBuffered uint64
}
type ProofSetIDProvider ¶ added in v0.0.18
type ProofSetState ¶ added in v0.0.15
type ProofSetState struct {
ID uint64
// if the proof set has been initialized with a root, and is expecting proofs to be submitted.
Initialized bool
// When the next challenge for a proof will be issued
NextChallengeEpoch int64
// When the last challenge for a proof was issued
PreviousChallengeEpoch int64
// The proving period of this proof set
ProvingPeriod int64
// The challenge window of this proof set
ChallengeWindow int64
// The current epoch of the chain
CurrentEpoch int64
// true if a challenge has been issued: CurrentEpoch >= NextChallengeEpoch
ChallengedIssued bool
// true if in challenge window: CurrentEpoch < NextChallengeEpoch + ChallengeWindow
InChallengeWindow bool
// true if we missed the challenge: CurrentEpoch > NextChallengeEpoch + ChallengeWindow
IsInFaultState bool
// true if we submitted a proof for the current ChallengeWindow
HasProven bool
// true if the node is currently generating a proof
IsProving bool
// The state of the proof set present in the contract
ContractState ProofSetContractState
}
type ProofSetStatus ¶
func (ProofSetStatus) MarshalLogObject ¶
func (p ProofSetStatus) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for ProofSetStatus
type ProviderAPI ¶ added in v0.0.17
type ProviderAPI interface {
RegisterProvider(ctx context.Context, params RegisterProviderParams) (RegisterProviderResults, error)
GetProviderStatus(ctx context.Context) (GetProviderStatusResults, error)
}
type ReadPieceConfig ¶ added in v0.0.14
type ReadPieceConfig struct {
ByteRange Range
}
func (*ReadPieceConfig) ProcessOptions ¶ added in v0.0.14
func (c *ReadPieceConfig) ProcessOptions(opts []ReadPieceOption)
type ReadPieceOption ¶ added in v0.0.14
type ReadPieceOption func(c *ReadPieceConfig)
func WithRange ¶ added in v0.0.14
func WithRange(start uint64, end *uint64) ReadPieceOption
type RegisterProviderParams ¶ added in v0.0.17
type RegisterProviderResults ¶ added in v0.0.17
type RegisterProviderResults struct {
// transaction hash of message sent by provider to register, when set all
// other fields are empty
TransactionHash common.Hash
// address of the provider
Address common.Address
// address the provider will receive payment on
Payee common.Address
// ID of provider
ID uint64
// True if the provider is registered (don't imply they have been approved
// the service contract.
IsActive bool
// Optional name chosen by provider
Name string
// Optional description chosen by provider
Description string
}
type RootAdd ¶
func (RootAdd) MarshalLogObject ¶
func (r RootAdd) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler for RootAdd
Click to show internal directories.
Click to hide internal directories.