model

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteUploadToDatabase

func WriteUploadToDatabase(writer UploadWriter, upload *Upload) error

WriteUploadToDatabase writes an upload to the database using the provided writer function.

Types

type Upload

type Upload struct {
	// contains filtered or unexported fields
}

Upload represents the process of full or partial upload of data from a source, eventually represented as an upload in storacha.

func NewUpload

func NewUpload(spaceDID did.DID, sourceID id.SourceID) (*Upload, error)

NewUpload creates a new Upload instance with the given parameters.

func ReadUploadFromDatabase

func ReadUploadFromDatabase(scanner UploadScanner) (*Upload, error)

ReadUploadFromDatabase reads an upload from the database using the provided scanner function.

func (*Upload) CreatedAt

func (u *Upload) CreatedAt() time.Time

CreatedAt returns the creation time of the upload.

func (*Upload) HasRootFSEntryID

func (u *Upload) HasRootFSEntryID() bool

func (*Upload) ID

func (u *Upload) ID() id.UploadID

ID returns the unique identifier of the upload.

func (*Upload) Invalidate

func (u *Upload) Invalidate() error

Invalidate clears the root CID and root FSEntryID of the upload, meaning that it needs to be scanned again.

func (*Upload) RootCID

func (u *Upload) RootCID() cid.Cid

func (*Upload) RootFSEntryID

func (u *Upload) RootFSEntryID() id.FSEntryID

func (*Upload) SetRootCID

func (u *Upload) SetRootCID(rootCID cid.Cid) error

func (*Upload) SetRootFSEntryID

func (u *Upload) SetRootFSEntryID(rootFSEntryID id.FSEntryID) error

func (*Upload) SourceID

func (u *Upload) SourceID() id.SourceID

SourceID returns the ID of the source associated with the upload.

func (*Upload) SpaceDID

func (u *Upload) SpaceDID() did.DID

SpaceDID returns the DID of the space associated with the upload.

type UploadScanner

type UploadScanner func(id *id.UploadID, spaceDID *did.DID, sourceID *id.SourceID, createdAt *time.Time, updatedAt *time.Time, rootFSEntryID *id.FSEntryID, rootCID *cid.Cid) error

UploadScanner is a function type that defines the signature for scanning uploads from a database row

type UploadWriter

type UploadWriter func(id id.UploadID, spaceDID did.DID, sourceID id.SourceID, createdAt time.Time, updatedAt time.Time, rootFSEntryID id.FSEntryID, rootCID cid.Cid) error

UploadWriter is a function type that defines the signature for writing uploads to a database row

Jump to

Keyboard shortcuts

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