Help us shape the future of Go! Take the 2026 Go Developer Survey

storageremoval

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package storageremoval owns deletion batches and their durable send evidence.

Index

Constants

View Source
const MaxEnqueuedRemovals = 2000

Variables

This section is empty.

Functions

func AutoResendSupported

func AutoResendSupported(version string) bool

func ConfirmationTimeoutStart

func ConfirmationTimeoutStart(firstAttempted, workStarted time.Time) time.Time

func NewRequestID

func NewRequestID() (string, error)

func NextSendSet

func NextSendSet(previous, candidate []int64) ([]int64, error)

NextSendSet rejects members outside an exposed authorization's exact set. An empty previous set represents a batch without an exposed authorization.

func RemovalStalledAfter

func RemovalStalledAfter(period, window time.Duration) time.Duration

func ValidateInput

func ValidateInput(input Input) error

Types

type AttentionCode

type AttentionCode string
const (
	AttentionIdentityMismatch    AttentionCode = "identity_mismatch"
	AttentionPayerUnderfunded    AttentionCode = "payer_underfunded"
	AttentionProviderUnreachable AttentionCode = "provider_unreachable"
	AttentionConfirmationTimeout AttentionCode = "confirmation_timeout"
	AttentionTransactionReverted AttentionCode = "transaction_reverted"
	AttentionRemovalStalled      AttentionCode = "removal_stalled"
	AttentionCleanupStalled      AttentionCode = "cleanup_stalled"
)

func ParseAttentionCode

func ParseAttentionCode(value string) (AttentionCode, error)

func (AttentionCode) IsStop

func (c AttentionCode) IsStop() bool

func (AttentionCode) Valid

func (c AttentionCode) Valid() bool

type FailedReceiptClass

type FailedReceiptClass int
const (
	FailedReceiptInsufficient FailedReceiptClass = iota
	FailedReceiptCollision
	FailedReceiptReverted
)

func ClassifyFailedReceipt

func ClassifyFailedReceipt(pieces []ReceiptPiece, receiptBlock uint64, receiptStable bool) FailedReceiptClass

type Input

type Input struct {
	storagepipeline.ExecutionIdentity
	RequestID string `json:"request_id"`
}

type ReceiptPiece

type ReceiptPiece struct {
	Removed     bool
	Queued      bool
	BlockNumber uint64
}

type Request

type Request struct {
	bun.BaseModel    `bun:"table:storage_removal_requests,alias:removal_request"`
	RequestID        string        `bun:"request_id,type:text,pk"`
	StorageDataSetID int64         `bun:"storage_data_set_id,notnull"`
	Status           RequestStatus `bun:"status,type:text,notnull"`
	TaskID           *int64        `bun:"task_id,nullzero"`
	SealedAt         *time.Time    `bun:"sealed_at,nullzero"`
	QueuedAt         *time.Time    `bun:"queued_at,nullzero"`
	QueuedBlock      *int64        `bun:"queued_block,nullzero"`
	AttentionCode    *string       `bun:"attention_code,type:text,nullzero"`
	AttentionAt      *time.Time    `bun:"attention_at,nullzero"`
	LastError        *string       `bun:"last_error,type:text,nullzero"`
	CreatedAt        time.Time     `bun:"created_at,nullzero,notnull"`
	UpdatedAt        time.Time     `bun:"updated_at,nullzero,notnull"`
}

func (*Request) BeforeAppendModel

func (r *Request) BeforeAppendModel(_ context.Context, query bun.Query) error

type RequestStatus

type RequestStatus string
const (
	RequestStatusCollecting RequestStatus = "collecting"
	RequestStatusReady      RequestStatus = "ready"
	RequestStatusSubmitted  RequestStatus = "submitted"
	RequestStatusQueued     RequestStatus = "queued"
	RequestStatusSettled    RequestStatus = "settled"
	RequestStatusAbandoned  RequestStatus = "abandoned"
)

func (RequestStatus) Terminal

func (s RequestStatus) Terminal() bool

func (RequestStatus) Valid

func (s RequestStatus) Valid() bool

type Send

type Send struct {
	bun.BaseModel   `bun:"table:storage_removal_sends,alias:removal_send"`
	RequestID       string      `bun:"request_id,type:text,pk"`
	SendNo          int         `bun:"send_no,type:integer,pk"`
	TaskID          *int64      `bun:"task_id,nullzero"`
	AttemptedAt     *time.Time  `bun:"attempted_at,nullzero"`
	TxHash          *string     `bun:"tx_hash,type:text,nullzero"`
	ConfirmedTxHash *string     `bun:"confirmed_tx_hash,type:text,nullzero"`
	ReceiptStatus   *int64      `bun:"receipt_status,type:smallint,nullzero"`
	RefusedAt       *time.Time  `bun:"refused_at,nullzero"`
	UnsentAt        *time.Time  `bun:"unsent_at,nullzero"`
	LastError       *string     `bun:"last_error,type:text,nullzero"`
	CreatedAt       time.Time   `bun:"created_at,nullzero,notnull"`
	UpdatedAt       time.Time   `bun:"updated_at,nullzero,notnull"`
	Pieces          []SendPiece `bun:"-"`
}

Send preserves one admission, including authorizations refused by a provider.

func (*Send) BeforeAppendModel

func (s *Send) BeforeAppendModel(_ context.Context, query bun.Query) error

func (Send) Exposed

func (s Send) Exposed() bool

func (Send) InFlight

func (s Send) InFlight() bool

func (Send) PossiblyAccepted

func (s Send) PossiblyAccepted() bool

type SendPiece

type SendPiece struct {
	bun.BaseModel `bun:"table:storage_removal_send_pieces"`
	RequestID     string            `bun:"request_id,type:text,pk"`
	SendNo        int               `bun:"send_no,type:integer,pk"`
	CleanupCopyID int64             `bun:"cleanup_copy_id,pk"`
	PieceID       idtypes.OnChainID `bun:"piece_id,type:text,notnull"`
	CreatedAt     time.Time         `bun:"created_at,nullzero,notnull"`
}

func (*SendPiece) BeforeAppendModel

func (p *SendPiece) BeforeAppendModel(_ context.Context, query bun.Query) error

type TaskBatch

type TaskBatch struct {
	TaskID        int64              `bun:"task_id"`
	OwnsRequest   bool               `bun:"owns_request"`
	RequestID     string             `bun:"request_id"`
	Status        RequestStatus      `bun:"status"`
	AttentionCode *string            `bun:"attention_code"`
	AttentionAt   *time.Time         `bun:"attention_at"`
	ProviderID    idtypes.OnChainID  `bun:"provider_id,type:text"`
	DataSetID     *idtypes.OnChainID `bun:"data_set_id,type:text"`
	PieceCount    int                `bun:"piece_count"`
	TxHash        *string            `bun:"tx_hash"`
	LastError     *string            `bun:"last_error"`
}

TaskBatch projects a task's removal batch and current ownership.

Jump to

Keyboard shortcuts

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