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

storagepull

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: 4 Imported by: 0

Documentation

Overview

Package storagepull owns the ledger of provider-side copy attempts. A pull asks a target provider to fetch one piece from a source provider. The target request is idempotent through its authorization extra data; AttemptID names the internal ledger row across recovery.

Index

Constants

View Source
const (
	FailureOutcomeUnknown  = "pull_outcome_unknown"
	FailureRecoveryBlocked = "pull_recovery_blocked"
	WaitQueueFull          = "pull_queue_full"
)

These task reasons preserve the request and copy owner until recovery can establish the provider's outcome.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attempt

type Attempt struct {
	bun.BaseModel `bun:"table:storage_pull_attempts,alias:storage_pull_attempt"`

	AttemptID        string        `bun:"type:text,pk"`
	ContentID        int64         `bun:",notnull"`
	StorageDataSetID int64         `bun:",notnull"`
	Status           AttemptStatus `bun:"type:text,notnull"`
	// The source the piece was pulled from, recorded before the request is sent
	// so recovery never invents a different one.
	SourceProviderID types.OnChainID `bun:"type:text,notnull"`
	SourceDataSetID  types.OnChainID `bun:"type:text,notnull"`
	SourcePieceID    types.OnChainID `bun:"type:text,notnull"`
	// SourcePieceCID names the piece itself, distinct from the content's own CID.
	SourcePieceCID     string     `bun:"type:text,notnull"`
	SourceRetrievalURL string     `bun:"type:text,notnull"`
	ExtraDataHex       string     `bun:"type:text,notnull"`
	LastError          *string    `bun:"type:text,nullzero"`
	AttemptedAt        time.Time  `bun:",nullzero,notnull"`
	ResolvedAt         *time.Time `bun:",nullzero"`
	CreatedAt          time.Time  `bun:",nullzero,notnull"`
	UpdatedAt          time.Time  `bun:",nullzero,notnull"`
}

Attempt records the source and authorization before a request reaches the target provider. Recovery replays this request without changing its identity.

func (*Attempt) BeforeAppendModel

func (a *Attempt) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.

type AttemptStatus

type AttemptStatus string

AttemptStatus distinguishes replayable requests from abandoned ones. ResolvedAt records completion: a resolved attempted row succeeded, while a resolved abandoned row will no longer be observed or replayed.

const (
	AttemptStatusAttempted AttemptStatus = "attempted"
	AttemptStatusAbandoned AttemptStatus = "abandoned"
)

Jump to

Keyboard shortcuts

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