storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PendingBlob

type PendingBlob struct {
	ID       int64
	QueueID  int64
	Path     string
	BlobCID  string
	BlobData []byte
}

PendingBlob is a finalized bundle blob awaiting upload.

type PendingCAR

type PendingCAR struct {
	ID       int64
	LogDID   string
	TreeSize uint64
	HeadCID  string
	CARData  []byte
}

PendingCAR is a CAR awaiting upload in the upload queue.

type QueueStore

type QueueStore interface {
	// EnqueueAndUpdateHead atomically writes to latest_head_car and inserts an
	// upload_queue row (plus any blob rows). Returns the new queue entry ID.
	EnqueueAndUpdateHead(ctx context.Context, logDID string, treeSize uint64, headCID string, carData []byte, blobs []PendingBlob) (int64, error)

	DequeuePendingCARs(ctx context.Context, limit int) ([]PendingCAR, error)
	GetPendingBlobsForCAR(ctx context.Context, queueID int64) ([]PendingBlob, error)
	MarkCARUploaded(ctx context.Context, id int64) error
	MarkCARFailed(ctx context.Context, id int64, errMsg string) error
	MarkBlobUploaded(ctx context.Context, id int64) error
	MarkBlobFailed(ctx context.Context, id int64, errMsg string) error
}

QueueStore manages the async upload queue. LogStore implements this interface.

type StateStore

type StateStore interface {
	// Log metadata — reads from latest_head_car.
	GetHead(ctx context.Context, logDID string) (indexCID string, treeSize uint64, err error)

	// Tree state
	GetTreeState(ctx context.Context, logDID string) (size uint64, root []byte, err error)
	SetTreeState(ctx context.Context, logDID string, size uint64, root []byte) error

	// Revocations
	AddRevocation(ctx context.Context, delegationCID string) error
	IsRevoked(ctx context.Context, delegationCID string) (bool, error)
	GetRevocations(ctx context.Context) ([]string, error)

	// Latest head CAR — updated synchronously on every append.
	// Enables cold-start restore without a gateway round-trip.
	SetLatestHeadCAR(ctx context.Context, logDID string, treeSize uint64, headCID string, carData []byte) error
	GetLatestHeadCAR(ctx context.Context, logDID string) (headCID string, treeSize uint64, carData []byte, err error)
}

StateStore abstracts state storage operations. This allows the existing code to work with either JSON files or SQLite.

Directories

Path Synopsis
Package storacha provides a Tessera storage driver that uses Storacha (decentralized storage network) as the backend.
Package storacha provides a Tessera storage driver that uses Storacha (decentralized storage network) as the backend.
storachatest
Package storachatest provides test helpers for Storacha storage
Package storachatest provides test helpers for Storacha storage
uploadqueue
Package uploadqueue provides an async upload queue for Storacha CAR uploads.
Package uploadqueue provides an async upload queue for Storacha CAR uploads.

Jump to

Keyboard shortcuts

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