uploads

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Worker

func Worker(ctx context.Context, in <-chan struct{}, doWork func() error, finalize func() error) error

Types

type API

type API struct {
	Repo                       Repo
	ExecuteScan                ExecuteScanFunc
	ExecuteDagScansForUpload   ExecuteDagScansForUploadFunc
	AddShardsForUpload         AddShardsForUploadFunc
	AddIndexesForUpload        AddIndexesForUploadFunc
	AddStorachaUploadForUpload AddStorachaUploadForUploadFunc
	RemoveBadFSEntry           RemoveBadFSEntryFunc
	RemoveBadNodes             RemoveBadNodesFunc
	RemoveShard                RemoveShardFunc

	// AddNodeToUploadShards adds a node to the upload's shards, creating a new
	// shard if necessary. It returns true if an existing open shard was closed,
	// false otherwise.
	AddNodeToUploadShards AddNodeToUploadShardsFunc

	// CloseUploadShards closes any remaining open shard for the upload. It
	// returns true if an existing open shard was in fact closed, false if there
	// was no open shard to close.
	CloseUploadShards CloseUploadShardsFunc
}

func (API) ExecuteUpload

func (a API) ExecuteUpload(ctx context.Context, uploadID id.UploadID, spaceDID did.DID) (cid.Cid, error)

ExecuteUpload executes the upload process for a given upload, handling its state transitions and processing steps.

func (API) FindOrCreateUploads

func (a API) FindOrCreateUploads(ctx context.Context, spaceDID did.DID) ([]*model.Upload, error)

FindOrCreateUploads creates uploads for a given space and its associated sources.

func (API) GetUploadByID

func (a API) GetUploadByID(ctx context.Context, uploadID id.UploadID) (*model.Upload, error)

GetUploadByID retrieves an upload by its unique ID.

type AddIndexesForUploadFunc

type AddIndexesForUploadFunc func(ctx context.Context, uploadID id.UploadID, spaceDID did.DID) error

type AddNodeToUploadShardsFunc

type AddNodeToUploadShardsFunc func(ctx context.Context, uploadID id.UploadID, spaceDID did.DID, nodeCID cid.Cid, data []byte) (bool, error)

type AddShardsForUploadFunc

type AddShardsForUploadFunc func(ctx context.Context, uploadID id.UploadID, spaceDID did.DID) error

type AddStorachaUploadForUploadFunc

type AddStorachaUploadForUploadFunc func(ctx context.Context, uploadID id.UploadID, spaceDID did.DID) error

type CloseUploadShardsFunc

type CloseUploadShardsFunc func(ctx context.Context, uploadID id.UploadID) (bool, error)

type ExecuteDagScansForUploadFunc

type ExecuteDagScansForUploadFunc func(ctx context.Context, uploadID id.UploadID, nodeCB func(node dagmodel.Node, data []byte) error) error

type ExecuteScanFunc

type ExecuteScanFunc func(ctx context.Context, uploadID id.UploadID, nodeCB func(node scanmodel.FSEntry) error) error

type RemoveBadFSEntryFunc

type RemoveBadFSEntryFunc func(ctx context.Context, spaceDID did.DID, fsEntryID id.FSEntryID) error

type RemoveBadNodesFunc

type RemoveBadNodesFunc func(ctx context.Context, spaceDID did.DID, nodeCIDs []cid.Cid) error

type RemoveShardFunc

type RemoveShardFunc func(ctx context.Context, shardID id.ShardID) error

type Repo

type Repo interface {
	// GetUploadByID retrieves an upload by its unique ID.
	GetUploadByID(ctx context.Context, uploadID id.UploadID) (*uploadmodel.Upload, error)
	// FindOrCreateUploads ensures uploads exist for a given space
	FindOrCreateUploads(ctx context.Context, spaceDID did.DID, sourceIDs []id.SourceID) ([]*uploadmodel.Upload, error)
	// UpdateUpload updates the state of an upload in the repository.
	UpdateUpload(ctx context.Context, upload *uploadmodel.Upload) error
	// CIDForFSEntry retrieves the CID for a file system entry by its ID.
	CIDForFSEntry(ctx context.Context, fsEntryID id.FSEntryID) (cid.Cid, error)
	// CreateDAGScan creates a new DAG scan for a file system entry.
	CreateDAGScan(ctx context.Context, fsEntryID id.FSEntryID, isDirectory bool, uploadID id.UploadID, spaceDID did.DID) (dagmodel.DAGScan, error)
	// ListSpaceSources lists all space sources for the given space DID.
	ListSpaceSources(ctx context.Context, spaceDID did.DID) ([]id.SourceID, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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