Documentation
¶
Index ¶
- Constants
- Variables
- func AutoMigrate(db *gorm.DB) error
- func DropAll(db *gorm.DB) error
- func IsSecretConfigName(key string) bool
- func StoragePricePerEpochToPricePerDeal(price string, dealSize int64, durationEpoch int32) float64
- type Actor
- type CID
- type Car
- type CarBlock
- type CarBlockID
- type CarID
- type ClientConfig
- type ConfigMap
- type DDOAllocationStatus
- type Deal
- type DealID
- type DealState
- type DealType
- type Directory
- type DirectoryID
- type File
- type FileID
- type FileRange
- type FileRangeID
- type Global
- type Job
- type JobID
- type JobState
- type JobType
- type OutputAttachment
- type OutputAttachmentID
- type PDPProofSet
- type PieceType
- type Preparation
- type PreparationID
- type ProofSetHandoffState
- type Schedule
- type ScheduleID
- type ScheduleState
- type SourceAttachment
- func (s *SourceAttachment) FindByPreparationAndSource(db *gorm.DB, preparation string, source string) error
- func (s *SourceAttachment) RootDirectoryCID(ctx context.Context, db *gorm.DB) (cid.Cid, error)
- func (s *SourceAttachment) RootDirectoryID(ctx context.Context, db *gorm.DB) (DirectoryID, error)
- type SourceAttachmentID
- type Storage
- type StorageID
- type StringSlice
- type Wallet
- type Worker
- type WorkerType
Constants ¶
const ( // PDPProofSetMaxPieceSize is Singularity's current PDP max piece size policy: // 1 GiB minus FR32 expansion overhead. PDPProofSetMaxPieceSize int64 = (1 << 30) * 127 / 128 // 1,065,353,216 bytes )
Variables ¶
var ( ErrInvalidCIDEntry = errors.New("invalid CID entry in the database") ErrInvalidStringSliceEntry = errors.New("invalid string slice entry in the database") ErrInvalidStringMapEntry = errors.New("invalid string map entry in the database") ErrInvalidHTTPConfigEntry = errors.New("invalid ClientConfig entry in the database") )
var DealStateStrings = []string{ string(DealProposed), string(DealPublished), string(DealActive), string(DealExpired), string(DealProposalExpired), string(DealRejected), string(DealSlashed), string(DealErrored), }
var DealStates = []DealState{ DealProposed, DealPublished, DealActive, DealExpired, DealProposalExpired, DealRejected, DealSlashed, DealErrored, }
var DealTypeStrings = []string{ string(DealTypeMarket), string(DealTypePDP), string(DealTypeDDO), }
var DealTypes = []DealType{ DealTypeMarket, DealTypePDP, DealTypeDDO, }
var ErrInvalidJobState = errors.New("invalid job state")
var JobStateStrings = []string{ string(Created), string(Ready), string(Paused), string(Processing), string(Complete), string(Error), }
var JobStates = []JobState{ Created, Ready, Paused, Processing, Complete, Error, }
var JobTypes = []JobType{ Scan, Pack, DagGen, }
var ScheduleStateStrings = []string{ string(ScheduleActive), string(SchedulePaused), string(ScheduleError), string(ScheduleCompleted), }
var ScheduleStates = []ScheduleState{ ScheduleActive, SchedulePaused, ScheduleError, ScheduleCompleted, }
var Tables = []any{ &Worker{}, &Global{}, &Preparation{}, &Storage{}, &OutputAttachment{}, &SourceAttachment{}, &Job{}, &File{}, &FileRange{}, &Directory{}, &Car{}, &CarBlock{}, &Deal{}, &Schedule{}, &Actor{}, &Wallet{}, &PDPProofSet{}, }
Functions ¶
func AutoMigrate ¶
AutoMigrate attempts to automatically migrate the database schema.
This function performs a few operations:
- Automatically migrates the tables in the database to match the structures defined in the application.
- Migrates FK constraints that changed from CASCADE to SET NULL (for fast prep deletion).
- Creates an instance ID if it doesn't already exist.
- Generates a new encryption salt and stores it in the database if it doesn't already exist.
The purpose of the auto-migration feature is to simplify schema changes and manage basic system configurations without manually altering the database. This is especially useful during development or when deploying updates that include schema changes.
Parameters:
- db: A pointer to a gorm.DB object, which provides database access.
Returns:
- An error if any issues arise during the process, otherwise nil.
func DropAll ¶
DropAll removes all tables specified in the Tables slice from the database.
This function is typically used during development or testing where a clean database slate is required. It iterates over the predefined Tables list and drops each table. Care should be taken when using this function in production environments as it will result in data loss.
Parameters:
- db: A pointer to a gorm.DB object, which provides database access.
Returns:
- An error if any issues arise during the table drop process, otherwise nil.
func IsSecretConfigName ¶ added in v0.5.1
Types ¶
type Actor ¶ added in v1.0.0
type Actor struct {
ID string `gorm:"primaryKey;size:15" json:"id"` // actor ID (f0...)
Address string `gorm:"index" json:"address"` // filecoin address
}
on-chain actor identity tracked by singularity. actors we control have a Wallet with ActorID pointing here. actors we don't control (counterparties) exist as bare records.
type CID ¶
func (CID) MarshalBinary ¶ added in v0.2.14
func (CID) MarshalJSON ¶
func (*CID) UnmarshalBinary ¶ added in v0.2.14
func (*CID) UnmarshalJSON ¶
type Car ¶
type Car struct {
ID CarID `` /* 143-byte string literal not displayed */
CreatedAt time.Time `` /* 127-byte string literal not displayed */
PieceType PieceType `cbor:"0,keyasint,omitempty" json:"pieceType" swaggertype:"string"` // PieceType indicates whether this is a data piece or DAG piece
PieceCID CID `` /* 148-byte string literal not displayed */
PieceSize int64 `cbor:"2,keyasint,omitempty" json:"pieceSize"`
RootCID CID `` /* 148-byte string literal not displayed */
FileSize int64 `cbor:"4,keyasint,omitempty" json:"fileSize"`
MinPieceSizePadding int64 `cbor:"5,keyasint,omitempty" json:"minPieceSizePadding"` // MinPieceSizePadding tracks virtual padding for inline mode only. Inline: stores padding amount, PieceReader serves zeros virtually. Non-inline: always 0, literal zeros are written to CAR file for Curio TreeD compatibility.
StorageID *StorageID `` /* 157-byte string literal not displayed */
Storage *Storage `` /* 163-byte string literal not displayed */
StoragePath string `cbor:"-" json:"storagePath"` // StoragePath is the path to the CAR file inside the storage. If the StorageID is nil but StoragePath is not empty, it means the CAR file is stored at the local absolute path.
NumOfFiles int64 `cbor:"-" json:"numOfFiles" table:"verbose"`
// Association - SET NULL for fast prep deletion, async cleanup
PreparationID *PreparationID `cbor:"-" gorm:"index" json:"preparationId" table:"-"`
Preparation *Preparation `` /* 129-byte string literal not displayed */
AttachmentID *SourceAttachmentID `cbor:"-" gorm:"index" json:"attachmentId" table:"-"`
Attachment *SourceAttachment `` /* 129-byte string literal not displayed */
JobID *JobID `cbor:"-" gorm:"index" json:"jobId,omitempty" table:"-"`
Job *Job `` /* 129-byte string literal not displayed */
}
Car makes a reference to a CAR file that has been potentially exported to the disk. In the case of inline preparation, the path may be empty so the Car should be constructed on the fly using CarBlock. The index on PieceCID is to find all CARs that can matches the PieceCID
type CarBlock ¶
type CarBlock struct {
ID CarBlockID `cbor:"-" gorm:"primaryKey" json:"id"`
CID CID `cbor:"1,keyasint,omitempty" gorm:"index;column:cid;type:bytes;size:255" json:"cid" swaggertype:"string"` // CID is the CID of the block.
CarOffset int64 `cbor:"2,keyasint,omitempty" json:"carOffset"` // Offset of the block in the Car
CarBlockLength int32 `cbor:"3,keyasint,omitempty" json:"carBlockLength"` // Length of the block in the Car, including varint, CID and raw block
Varint []byte `cbor:"4,keyasint,omitempty" json:"varint"` // Varint is the varint that represents the length of the block and the CID.
RawBlock []byte `cbor:"5,keyasint,omitempty" json:"rawBlock"` // Raw block
FileOffset int64 `cbor:"6,keyasint,omitempty" json:"fileOffset"` // Offset of the block in the File
// Associations - SET NULL for fast prep deletion, async cleanup
CarID *CarID `cbor:"-" gorm:"index" json:"carId"`
Car *Car `cbor:"-" gorm:"foreignKey:CarID;constraint:OnDelete:SET NULL" json:"car,omitempty" swaggerignore:"true"`
FileID *FileID `cbor:"7,keyasint,omitempty" gorm:"index" json:"fileId"`
File *File `cbor:"-" gorm:"foreignKey:FileID;constraint:OnDelete:SET NULL" json:"file,omitempty" swaggerignore:"true"`
// contains filtered or unexported fields
}
CarBlock tells us the CIDs of all blocks inside a Car and the offset of those blocks. From this table we can determine how to get the block by CID from a Car. Or we can determine how to assemble a CAR file from blocks from File. It is also possible to get all Car that are associated with File. The index on CarID is used to find all blocks in a Car. The index on CID is used to find a specific block with CID.
func (CarBlock) BlockLength ¶
BlockLength computes and returns the length of the block data in bytes. If the block length has already been calculated and stored, it returns the stored value. Otherwise, it calculates the block length based on the raw block data if it is available, or by subtracting the CID byte length and varint length from the total CarBlock length.
Returns:
- An int32 representing the length of the block data in bytes.
type CarBlockID ¶ added in v0.5.0
type CarBlockID uint64
type ClientConfig ¶ added in v0.5.0
type ClientConfig struct {
ConnectTimeout *time.Duration `cbor:"1,keyasint,omitempty" json:"connectTimeout,omitempty" swaggertype:"primitive,integer"` // HTTP Client Connect timeout
Timeout *time.Duration `cbor:"2,keyasint,omitempty" json:"timeout,omitempty" swaggertype:"primitive,integer"` // IO idle timeout
ExpectContinueTimeout *time.Duration `cbor:"3,keyasint,omitempty" json:"expectContinueTimeout,omitempty" swaggertype:"primitive,integer"` // Timeout when using expect / 100-continue in HTTP
InsecureSkipVerify *bool `cbor:"4,keyasint,omitempty" json:"insecureSkipVerify,omitempty"` // Do not verify the server SSL certificate (insecure)
NoGzip *bool `cbor:"5,keyasint,omitempty" json:"noGzip,omitempty"` // Don't set Accept-Encoding: gzip
UserAgent *string `cbor:"6,keyasint,omitempty" json:"userAgent,omitempty"` // Set the user-agent to a specified string
CaCert []string `cbor:"7,keyasint,omitempty" json:"caCert,omitempty"` // Paths to CA certificate used to verify servers
ClientCert *string `cbor:"8,keyasint,omitempty" json:"clientCert,omitempty"` // Path to Client SSL certificate (PEM) for mutual TLS auth
ClientKey *string `cbor:"9,keyasint,omitempty" json:"clientKey,omitempty"` // Path to Client SSL private key (PEM) for mutual TLS auth
Headers map[string]string `cbor:"10,keyasint,omitempty" json:"headers,omitempty"` // Set HTTP header for all transactions
DisableHTTP2 *bool `cbor:"11,keyasint,omitempty" json:"disableHttp2,omitempty"` // Disable HTTP/2 in the transport
DisableHTTPKeepAlives *bool `cbor:"12,keyasint,omitempty" json:"disableHttpKeepAlives,omitempty"` // Disable HTTP keep-alives and use each connection once.
RetryMaxCount *int `cbor:"13,keyasint,omitempty" json:"retryMaxCount,omitempty"` // Maximum number of retries. Default is 10 retries.
RetryDelay *time.Duration `cbor:"14,keyasint,omitempty" json:"retryDelay,omitempty" swaggertype:"primitive,integer"` // Delay between retries. Default is 1s.
RetryBackoff *time.Duration `cbor:"15,keyasint,omitempty" json:"retryBackoff,omitempty" swaggertype:"primitive,integer"` // Constant backoff between retries. Default is 1s.
RetryBackoffExponential *float64 `cbor:"16,keyasint,omitempty" json:"retryBackoffExponential,omitempty"` // Exponential backoff between retries. Default is 1.0.
SkipInaccessibleFile *bool `cbor:"17,keyasint,omitempty" json:"skipInaccessibleFile,omitempty"` // Skip inaccessible files. Default is false.
UseServerModTime *bool `cbor:"18,keyasint,omitempty" json:"useServerModTime,omitempty"` // Use server modified time instead of object metadata
LowLevelRetries *int `cbor:"19,keyasint,omitempty" json:"lowlevelRetries,omitempty"` // Maximum number of retries for low-level client errors. Default is 10 retries.
ScanConcurrency *int `cbor:"20,keyasint,omitempty" json:"scanConcurrency,omitempty"` // Maximum number of concurrent scan requests. Default is 1.
}
func (*ClientConfig) Scan ¶ added in v0.5.0
func (c *ClientConfig) Scan(src any) error
func (ClientConfig) String ¶ added in v0.5.0
func (c ClientConfig) String() string
type DDOAllocationStatus ¶ added in v1.0.0
type Deal ¶
type Deal struct {
ID DealID `gorm:"primaryKey" json:"id" table:"verbose"`
CreatedAt time.Time `json:"createdAt" table:"verbose;format:2006-01-02 15:04:05"`
UpdatedAt time.Time `json:"updatedAt" table:"verbose;format:2006-01-02 15:04:05"`
LastVerifiedAt *time.Time `json:"lastVerifiedAt" table:"verbose;format:2006-01-02 15:04:05"` // LastVerifiedAt is the last time the deal was verified as active by the tracker
DealID *uint64 `gorm:"unique" json:"dealId"`
State DealState `gorm:"index:idx_pending" json:"state"`
DealType DealType `gorm:"index;default:'market'" json:"dealType"`
Provider string `json:"provider"`
ProposalID string `json:"proposalId" table:"verbose"`
Label string `json:"label" table:"verbose"`
PieceCID CID `gorm:"column:piece_cid;index;size:255" json:"pieceCid" swaggertype:"string"`
PieceSize int64 `json:"pieceSize"`
StartEpoch int32 `json:"startEpoch"`
EndEpoch int32 `json:"endEpoch" table:"verbose"`
SectorStartEpoch int32 `json:"sectorStartEpoch" table:"verbose"`
Price string `json:"price"`
Verified bool `json:"verified"`
ErrorMessage string `json:"errorMessage" table:"verbose"`
// PDP-specific fields (only populated for DealTypePDP)
ProofSetID *uint64 `json:"proofSetId,omitempty" table:"verbose"` // ProofSetID is the on-chain proof set ID for PDP deals
ProofSetLive *bool `json:"proofSetLive,omitempty" table:"verbose"` // ProofSetLive indicates if the proof set is live (actively being challenged)
NextChallengeEpoch *int32 `json:"nextChallengeEpoch,omitempty" table:"verbose"` // NextChallengeEpoch is the next epoch when a challenge proof is due
// DDO-specific fields (only populated for DealTypeDDO)
DDOAllocationID *uint64 `json:"ddoAllocationId,omitempty" table:"verbose"`
DDORailID *uint64 `json:"ddoRailId,omitempty" table:"verbose"`
DDOPaymentToken *string `json:"ddoPaymentToken,omitempty" table:"verbose"`
// Associations
ScheduleID *ScheduleID `json:"scheduleId" table:"verbose"`
Schedule *Schedule `gorm:"foreignKey:ScheduleID;constraint:OnDelete:SET NULL" json:"schedule,omitempty" swaggerignore:"true" table:"expand"`
ClientID string `gorm:"index:idx_pending" json:"clientId"`
WalletID *uint `gorm:"index:idx_deal_wallet" json:"walletId,omitempty" table:"verbose"`
Wallet *Wallet `gorm:"foreignKey:WalletID;constraint:OnDelete:SET NULL" json:"wallet,omitempty" swaggerignore:"true" table:"expand"`
}
Deal is the deal model for all deals made by deal pusher or tracked by the tracker. index on PieceCID tracks replication of same piece index on State and ClientID calculates pending deals
type DealState ¶
type DealState string
const ( DealProposed DealState = "proposed" DealPublished DealState = "published" DealActive DealState = "active" DealExpired DealState = "expired" DealProposalExpired DealState = "proposal_expired" DealRejected DealState = "rejected" DealSlashed DealState = "slashed" DealErrored DealState = "error" )
type DealType ¶ added in v1.0.0
type DealType string
DealType represents the type of deal (legacy market vs PDP)
const ( // DealTypeMarket represents legacy f05 market actor deals DealTypeMarket DealType = "market" // DealTypePDP represents f41 PDP (Proof of Data Possession) deals DealTypePDP DealType = "pdp" // DealTypeDDO represents DDO (Decentralized Data Onboarding) allocation deals DealTypeDDO DealType = "ddo" )
type Directory ¶
type Directory struct {
ID DirectoryID `gorm:"primaryKey" json:"id"`
CID CID `gorm:"column:cid;type:bytes" json:"cid" swaggertype:"string"` // CID is the CID of the directory.
Data []byte `gorm:"column:data" json:"-" swaggerignore:"true"` // Data is the serialized directory data.
Name string `json:"name"` // Name is the name of the directory.
Exported bool `json:"exported"` // Exported is a flag that indicates whether the directory has been exported to the DAG.
// Associations - AttachmentID SET NULL for fast prep deletion, async cleanup
AttachmentID *SourceAttachmentID `gorm:"index:directory_source_parent" json:"attachmentId"`
Attachment *SourceAttachment `gorm:"foreignKey:AttachmentID;constraint:OnDelete:SET NULL" json:"attachment,omitempty" swaggerignore:"true"`
ParentID *DirectoryID `gorm:"index:directory_source_parent" json:"parentId"`
Parent *Directory `gorm:"foreignKey:ParentID;constraint:OnDelete:CASCADE" json:"parent,omitempty" swaggerignore:"true"`
}
Directory is a link between parent and child directories. The index on AttachmentID and ParentID is used to find all root directories, as well as all directories in a directory.
type DirectoryID ¶ added in v0.5.0
type DirectoryID uint64
type File ¶ added in v0.3.0
type File struct {
ID FileID `cbor:"1,keyasint,omitempty" gorm:"primaryKey" json:"id"`
CID CID `cbor:"-" gorm:"column:cid;type:bytes;size:255" json:"cid" swaggertype:"string"` // CID is the CID of the file.
Path string `cbor:"2,keyasint,omitempty" gorm:"index" json:"path"` // Path is the relative path to the file inside the storage.
Hash string `cbor:"3,keyasint,omitempty" json:"hash"` // Hash is the hash of the file.
Size int64 `cbor:"4,keyasint,omitempty" json:"size"` // Size is the size of the file in bytes.
LastModifiedNano int64 `cbor:"5,keyasint,omitempty" json:"lastModifiedNano"`
// Associations - AttachmentID SET NULL for fast prep deletion, async cleanup
AttachmentID *SourceAttachmentID `cbor:"-" gorm:"index" json:"attachmentId"`
Attachment *SourceAttachment `cbor:"-" gorm:"foreignKey:AttachmentID;constraint:OnDelete:SET NULL" json:"attachment,omitempty" swaggerignore:"true"`
DirectoryID *DirectoryID `cbor:"-" gorm:"index" json:"directoryId"`
Directory *Directory `cbor:"-" gorm:"foreignKey:DirectoryID;constraint:OnDelete:CASCADE" json:"directory,omitempty" swaggerignore:"true"`
FileRanges []FileRange `cbor:"-" gorm:"constraint:OnDelete:CASCADE" json:"fileRanges,omitempty"`
}
File makes a reference to the source storage file, e.g., a local file. The index on Path is used as part of scanning to find existing file and add new versions. The index on DirectoryID is used to find all files in a directory.
type FileRange ¶ added in v0.3.0
type FileRange struct {
ID FileRangeID `gorm:"primaryKey" json:"id"`
Offset int64 `json:"offset"` // Offset is the offset of the range inside the file.
Length int64 `json:"length"` // Length is the length of the range in bytes.
CID CID `gorm:"column:cid;type:bytes" json:"cid" swaggertype:"string"` // CID is the CID of the range.
// Associations
JobID *JobID `gorm:"index" json:"jobId"`
Job *Job `gorm:"foreignKey:JobID;constraint:OnDelete:SET NULL" json:"job,omitempty" swaggerignore:"true"`
FileID FileID `gorm:"index" json:"fileId"`
File *File `gorm:"foreignKey:FileID;constraint:OnDelete:CASCADE" json:"file,omitempty" swaggerignore:"true"`
}
FileRange is a range of bytes inside File. The index on FileID is used to find all FileRange in a file. The index on JobID is used to find all FileRange in a job.
type FileRangeID ¶ added in v0.5.0
type FileRangeID uint64
type Job ¶ added in v0.4.0
type Job struct {
ID JobID `gorm:"primaryKey" json:"id"`
Type JobType `gorm:"index:job_type_state" json:"type"`
State JobState `gorm:"index:job_type_state" json:"state"`
ErrorMessage string `json:"errorMessage"`
ErrorStackTrace string `json:"errorStackTrace" table:"verbose"`
// Associations - AttachmentID SET NULL for fast prep deletion, async cleanup
WorkerID *string `gorm:"size:63;index" json:"workerId,omitempty"`
Worker *Worker `` /* 141-byte string literal not displayed */
AttachmentID *SourceAttachmentID `gorm:"index" json:"attachmentId" table:"verbose"`
Attachment *SourceAttachment `` /* 133-byte string literal not displayed */
FileRanges []FileRange `` /* 128-byte string literal not displayed */
}
Job is a job that is executed by a worker. The composite index on Type and State is used to find jobs that are ready to be executed.
type JobState ¶ added in v0.4.0
type JobState string
const ( // Created means the job has been created is not ready for processing. Created JobState = "created" // Ready means the job is ready for processing. Ready JobState = "ready" // Paused means the job is ready but has been paused and should not be picked up for processing. Paused JobState = "paused" // Processing means the job is currently being processed. Processing JobState = "processing" // Complete means the job is complete. Complete JobState = "complete" // Error means the job has some error. Error JobState = "error" )
type OutputAttachment ¶ added in v0.4.0
type OutputAttachment struct {
ID OutputAttachmentID `gorm:"primaryKey" json:"id"`
// Associations
PreparationID PreparationID `gorm:"uniqueIndex:prep_output" json:"preparationId"`
Preparation *Preparation `gorm:"foreignKey:PreparationID;constraint:OnDelete:CASCADE" json:"preparation,omitempty" swaggerignore:"true"`
StorageID StorageID `gorm:"uniqueIndex:prep_output" json:"storageId"`
Storage *Storage `gorm:"foreignKey:StorageID;constraint:OnDelete:CASCADE" json:"storage,omitempty" swaggerignore:"true"`
}
OutputAttachment is a link between a Preparation and a Storage that is used as an output.
type OutputAttachmentID ¶ added in v0.5.0
type OutputAttachmentID uint32
type PDPProofSet ¶ added in v1.0.0
type PDPProofSet struct {
SetID uint64 `gorm:"primaryKey;autoIncrement:false" json:"setId"`
ClientAddress string `gorm:"not null;index" json:"clientAddress"`
Provider string `gorm:"not null" json:"provider"`
IsLive bool `gorm:"default:false" json:"isLive"`
ChallengeEpoch *int64 ` json:"challengeEpoch,omitempty"`
CreatedBlock int64 `gorm:"not null" json:"createdBlock"`
Deleted bool `gorm:"default:false" json:"deleted"`
HandoffState ProofSetHandoffState `gorm:"default:'assembling'" json:"handoffState"`
PieceCount int `gorm:"default:0" json:"pieceCount"`
// ClientDataSetID is the per-(payer, set) nonce the client signs into
// CreateDataSet/AddPieces extraData. FWSS rejects reused IDs via its
// clientNonces[payer][id] check, so we persist before signing to make
// retries idempotent. Stored decimal because uint256 doesn't fit any
// native int.
ClientDataSetID string ` json:"clientDataSetId,omitempty"`
// ServiceURL caches the SP's PDP HTTP endpoint, fetched from
// ServiceProviderRegistry the first time we push to this provider.
ServiceURL string ` json:"serviceUrl,omitempty"`
}
PDPProofSet tracks on-chain PDP proof set state derived from contract events. This is a materialized view built from Shovel-indexed events, replacing the per-cycle RPC scans of GetProofSets/GetProofSetsForClient.
type Preparation ¶ added in v0.4.0
type Preparation struct {
ID PreparationID `gorm:"primaryKey" json:"id"`
Name string `gorm:"unique" json:"name"`
CreatedAt time.Time `json:"createdAt" table:"verbose;format:2006-01-02 15:04:05"`
UpdatedAt time.Time `json:"updatedAt" table:"verbose;format:2006-01-02 15:04:05"`
DeleteAfterExport bool `json:"deleteAfterExport"` // DeleteAfterExport is a flag that indicates whether the source files should be deleted after export.
MaxSize int64 `json:"maxSize"`
PieceSize int64 `json:"pieceSize"`
MinPieceSize int64 `json:"minPieceSize"` // Minimum piece size for the preparation, applies only to DAG and remainder pieces
NoInline bool `json:"noInline"`
NoDag bool `json:"noDag"`
// Associations
WalletID *uint `json:"walletId,omitempty"`
Wallet *Wallet `gorm:"foreignKey:WalletID;constraint:OnDelete:SET NULL" json:"wallet,omitempty" swaggerignore:"true" table:"expand"`
SourceStorages []Storage `` /* 134-byte string literal not displayed */
OutputStorages []Storage `` /* 134-byte string literal not displayed */
}
Preparation is a data preparation definition that can attach multiple source storages and up to one output storage.
func (*Preparation) FindByIDOrName ¶ added in v0.4.0
func (*Preparation) GetMinPieceSize ¶ added in v1.0.0
func (p *Preparation) GetMinPieceSize() int64
GetMinPieceSize returns the minimum piece size for the preparation, with a fallback to 1MiB if not set. This ensures backward compatibility with older preparations that don't have minPieceSize set.
func (*Preparation) SourceAttachments ¶ added in v0.5.2
func (s *Preparation) SourceAttachments(db *gorm.DB, preloads ...string) ([]SourceAttachment, error)
type PreparationID ¶ added in v0.5.0
type PreparationID uint32
type ProofSetHandoffState ¶ added in v1.0.0
type ProofSetHandoffState string
const ( ProofSetAssembling ProofSetHandoffState = "assembling" ProofSetProposed ProofSetHandoffState = "proposed" ProofSetTransferred ProofSetHandoffState = "transferred" )
type Schedule ¶
type Schedule struct {
ID ScheduleID `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"createdAt" table:"verbose;format:2006-01-02 15:04:05"`
UpdatedAt time.Time `json:"updatedAt" table:"verbose;format:2006-01-02 15:04:05"`
URLTemplate string `json:"urlTemplate" table:"verbose"`
HTTPHeaders ConfigMap `gorm:"type:JSON" json:"httpHeaders" table:"verbose"`
Provider string `json:"provider"`
PricePerGBEpoch float64 `json:"pricePerGbEpoch" table:"verbose"`
PricePerGB float64 `json:"pricePerGb" table:"verbose"`
PricePerDeal float64 `json:"pricePerDeal" table:"verbose"`
TotalDealNumber int `json:"totalDealNumber" table:"verbose"`
TotalDealSize int64 `json:"totalDealSize"`
Verified bool `json:"verified"`
KeepUnsealed bool `json:"keepUnsealed" table:"verbose"`
AnnounceToIPNI bool `gorm:"column:announce_to_ipni" json:"announceToIpni" table:"verbose"`
StartDelay time.Duration `json:"startDelay" swaggertype:"primitive,integer"`
Duration time.Duration `json:"duration" swaggertype:"primitive,integer"`
State ScheduleState `json:"state"`
ScheduleCron string `json:"scheduleCron"`
ScheduleCronPerpetual bool `json:"scheduleCronPerpetual"`
ScheduleDealNumber int `json:"scheduleDealNumber"`
ScheduleDealSize int64 `json:"scheduleDealSize"`
MaxPendingDealNumber int `json:"maxPendingDealNumber"`
MaxPendingDealSize int64 `json:"maxPendingDealSize"`
Group string `json:"group" table:"verbose"`
Notes string `json:"notes"`
ErrorMessage string `json:"errorMessage" table:"verbose"`
AllowedPieceCIDs StringSlice `gorm:"type:JSON;column:allowed_piece_cids" json:"allowedPieceCids" table:"verbose"`
Force bool `json:"force"`
DealType DealType `gorm:"index;default:'market'" json:"dealType"`
// Associations
PreparationID PreparationID `json:"preparationId"`
Preparation *Preparation `gorm:"foreignKey:PreparationID;constraint:OnDelete:CASCADE" json:"preparation,omitempty" swaggerignore:"true" table:"expand"`
}
type ScheduleID ¶ added in v0.5.0
type ScheduleID uint32
type ScheduleState ¶
type ScheduleState string
const ( ScheduleActive ScheduleState = "active" SchedulePaused ScheduleState = "paused" ScheduleError ScheduleState = "error" ScheduleCompleted ScheduleState = "completed" )
type SourceAttachment ¶ added in v0.4.0
type SourceAttachment struct {
ID SourceAttachmentID `gorm:"primaryKey" json:"id"`
// Associations
PreparationID PreparationID `gorm:"uniqueIndex:prep_source" json:"preparationId"`
Preparation *Preparation `gorm:"foreignKey:PreparationID;constraint:OnDelete:CASCADE" json:"preparation,omitempty" swaggerignore:"true"`
StorageID StorageID `gorm:"uniqueIndex:prep_source" json:"storageId"`
Storage *Storage `gorm:"foreignKey:StorageID;constraint:OnDelete:CASCADE" json:"storage,omitempty" swaggerignore:"true"`
}
SourceAttachment is a link between a Preparation and a Storage that is used as a source.
func (*SourceAttachment) FindByPreparationAndSource ¶ added in v0.4.0
func (*SourceAttachment) RootDirectoryCID ¶ added in v0.4.0
func (*SourceAttachment) RootDirectoryID ¶ added in v0.4.0
func (s *SourceAttachment) RootDirectoryID(ctx context.Context, db *gorm.DB) (DirectoryID, error)
type SourceAttachmentID ¶ added in v0.5.0
type SourceAttachmentID uint32
type Storage ¶ added in v0.4.0
type Storage struct {
ID StorageID `cbor:"-" gorm:"primaryKey" json:"id"`
Name string `cbor:"-" gorm:"unique" json:"name"`
CreatedAt time.Time `cbor:"-" json:"createdAt" table:"verbose;format:2006-01-02 15:04:05"`
UpdatedAt time.Time `cbor:"-" json:"updatedAt" table:"verbose;format:2006-01-02 15:04:05"`
Type string `cbor:"1,keyasint,omitempty" json:"type"`
Path string `cbor:"2,keyasint,omitempty" json:"path"` // Path is the path to the storage root.
Config ConfigMap `cbor:"3,keyasint,omitempty" gorm:"type:JSON" json:"config" table:"verbose"` // Config is a map of key-value pairs that can be used to store RClone options.
ClientConfig ClientConfig `cbor:"4,keyasint,omitempty" gorm:"type:JSON" json:"clientConfig" table:"verbose"` // ClientConfig is the HTTP configuration for the storage, if applicable.
// Associations
PreparationsAsSource []Preparation `` /* 144-byte string literal not displayed */
PreparationsAsOutput []Preparation `` /* 144-byte string literal not displayed */
}
Storage is a storage system definition that can be used as either source or output of a Preparation.
type StringSlice ¶
type StringSlice []string
func (*StringSlice) Scan ¶
func (ss *StringSlice) Scan(src any) error
type Wallet ¶
type Wallet struct {
ID uint `gorm:"primaryKey" json:"id"`
KeyPath string `gorm:"uniqueIndex;not null" json:"keyPath"` // keystore-relative name (typically the address)
KeyStore string `gorm:"default:'local';not null" json:"keyStore"` // local, yubikey, aws-kms, etc
Address string `gorm:"index;not null" json:"address"` // filecoin address (f1.../f3...)
Name string `json:"name,omitempty"` // optional label
ActorID *string `gorm:"index;size:15" json:"actorId,omitempty"` // nullable, links to on-chain actor f0...
Actor *Actor `` /* 127-byte string literal not displayed */
}
private key stored in external keystore, can be linked to on-chain actor wallets can exist before actors are created on-chain
type Worker ¶
type Worker struct {
ID string `gorm:"primaryKey" json:"id"`
LastHeartbeat time.Time `json:"lastHeartbeat"`
Hostname string `json:"hostname"`
Type WorkerType `json:"type"`
}
type WorkerType ¶ added in v0.4.0
type WorkerType string
const ( DealTracker WorkerType = "deal_tracker" DealPusher WorkerType = "deal_pusher" DatasetWorker WorkerType = "dataset_worker" PDPTracker WorkerType = "pdp_tracker" )