Documentation
¶
Overview ¶
Package uploadqueue provides an async upload queue for Storacha CAR uploads. CARs are enqueued synchronously (fast, local SQLite write) and uploaded to Storacha in the background by worker goroutines.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Store QueueStore
Uploader StorachaUploader
Parallelism int // default: 2
PollInterval time.Duration // default: 1s
MaxRetries int // default: 5
Logger *slog.Logger
}
Config holds configuration for the upload queue manager.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the async upload queue background worker.
func (*Manager) Notify ¶
func (m *Manager) Notify()
Notify wakes a sleeping worker. Call after enqueuing a new CAR. The channel buffer is intentionally size 1: rapid consecutive enqueues coalesce into a single notification. The second CAR will be picked up on the next poll cycle (PollInterval) or by a worker that just finished processing.
type QueueStore ¶
type QueueStore interface {
DequeuePendingCARs(ctx context.Context, limit int) ([]storage.PendingCAR, error)
GetPendingBlobsForCAR(ctx context.Context, queueID int64) ([]storage.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 is the storage interface required by the upload queue manager. *sqlite.LogStore implements this interface.
type StorachaUploader ¶
type StorachaUploader interface {
UploadFullStateCAR(ctx context.Context, carData []byte, rootCID cid.Cid, positions map[cid.Cid]blobindex.Position) (string, error)
UploadFinalizedBlob(ctx context.Context, data []byte) (string, error)
}
StorachaUploader uploads a full-state CAR to Storacha.