types

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	ProofSetAPI
	PieceAPI
}

type AllocatedPiece

type AllocatedPiece struct {
	Allocated bool
	Piece     cid.Cid
	UploadID  uuid.UUID
}

func (AllocatedPiece) MarshalLogObject

func (a AllocatedPiece) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler for AllocatedPiece

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error represents a service error with a kind

func NewError

func NewError(kind Kind, msg string) *Error

NewError creates a new error with the given kind and message

func NewErrorf

func NewErrorf(kind Kind, msg string, args ...interface{}) *Error

func WrapError

func WrapError(kind Kind, msg string, err error) *Error

WrapError wraps an existing error with a kind and message

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface

func (*Error) Kind

func (e *Error) Kind() Kind

Kind returns the error kind

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped error

type Kind

type Kind int

Kind represents the category of error

const (
	KindOther Kind = iota
	KindNotFound
	KindInvalidInput
	KindUnauthorized
	KindInternal
)

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 string

	// 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 {
	AllocatePiece(ctx context.Context, allocation PieceAllocation) (*AllocatedPiece, error)
	UploadPiece(ctx context.Context, upload PieceUpload) error
	FindPiece(ctx context.Context, piece Piece) (cid.Cid, bool, error)
	ReadPiece(ctx context.Context, piece cid.Cid) (*PieceReader, error)
}

type PieceAllocation

type PieceAllocation struct {
	Piece  Piece
	Notify *url.URL
}

func (PieceAllocation) MarshalLogObject

func (p PieceAllocation) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler for PieceAllocation

type PieceReader

type PieceReader struct {
	Size int64
	Data io.ReadCloser
}

func (PieceReader) MarshalLogObject

func (p PieceReader) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler for PieceReader

type PieceUpload

type PieceUpload struct {
	ID   uuid.UUID
	Data io.Reader
}

func (PieceUpload) MarshalLogObject

func (p PieceUpload) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler for PieceUpload

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, recordKeeper common.Address) (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 ProofSetStatus

type ProofSetStatus struct {
	TxHash   common.Hash
	TxStatus string
	Created  bool
	ID       uint64
}

func (ProofSetStatus) MarshalLogObject

func (p ProofSetStatus) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler for ProofSetStatus

type RootAdd

type RootAdd struct {
	Root     cid.Cid
	SubRoots []cid.Cid
}

func (RootAdd) MarshalLogObject

func (r RootAdd) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler for RootAdd

type RootEntry

type RootEntry struct {
	RootID        uint64
	RootCID       cid.Cid
	SubrootCID    cid.Cid
	SubrootOffset int64
}

func (RootEntry) MarshalLogObject

func (r RootEntry) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler for RootEntry

Jump to

Keyboard shortcuts

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