Documentation
¶
Index ¶
- Constants
- func ClampStorageCopies(copies int) int
- func ContentCacheKey(contentID int64) string
- func NewVersionID() string
- func UploadProgressPercent(uploaded, total int64) *int
- func ValidStorageCopies(copies int) bool
- type Bucket
- type BucketReplicaSlot
- type BucketReplicaSlotStatus
- type BucketStatus
- type CopyContinuationKind
- type DeploymentIdentity
- type MultipartPart
- type MultipartStatus
- type MultipartUpload
- type Object
- type ObjectCache
- type ObjectDeletion
- type ObjectState
- type ObjectSystemMetadata
- type ObjectVersion
- type S3Account
- type StorageCleanupCopy
- type StorageCleanupCopyStatus
- type StorageContent
- type StorageCopy
- func (s *StorageCopy) BeforeAppendModel(_ context.Context, query bun.Query) error
- func (c StorageCopy) CommitDecidedByRequest() bool
- func (c StorageCopy) CommitPinned() bool
- func (c StorageCopy) CommitSealed() bool
- func (c StorageCopy) ContinuationKind() CopyContinuationKind
- func (c StorageCopy) WorkTaskID() *int64
- type StorageCopyStatus
- type StorageCopyTransferMethod
- type StorageDataSet
- type StorageDataSetStatus
- type Task
- type TaskEvent
- type TaskObservation
- type TaskResumeMode
- type TaskRuntime
- type TaskSchedule
- type TaskStatus
- type TaskType
- type WalletOperation
- type WalletOperationStatus
- type WalletOperationType
Constants ¶
const ( StorageCopiesMin = 1 StorageCopiesMax = 8 )
const ( TaskSubjectStorageContent = "storage_content" TaskSubjectStorageCopy = "storage_copy" TaskSubjectStorageCommitRequest = "storage_commit_request" )
Task subjects that repository logic finds tasks by. Definitions of tasks with these subjects derive them from the task input, so the subject always names the row the input names.
Variables ¶
This section is empty.
Functions ¶
func ClampStorageCopies ¶
func ContentCacheKey ¶
ContentCacheKey returns the local cache path for one content payload. Cache residency is content-addressed, so versions that share bytes share a file and the key is derived rather than stored.
func NewVersionID ¶
func NewVersionID() string
NewVersionID returns an S3-compatible ULID version identifier.
func UploadProgressPercent ¶
UploadProgressPercent returns a byte-based integer percent when the total is known.
func ValidStorageCopies ¶
Types ¶
type Bucket ¶
type Bucket struct {
bun.BaseModel `bun:"table:buckets"`
ID int64 `bun:",pk,autoincrement,identity"`
Name string `bun:"type:text,unique,notnull"`
ACL []byte `bun:",nullzero"`
OwnerAccessKey *string `bun:"type:text,nullzero"`
// The durability policy is materialised at creation from configuration, so
// every bucket answers "how many replicas" without consulting config.
DefaultCopies int `bun:"type:integer,notnull"`
MinimumDurableCopies int `bun:"type:integer,notnull"`
DurabilityGeneration int64 `bun:",notnull,default:0"`
DurabilityTaskID *int64 `bun:",nullzero"`
Status BucketStatus `bun:"type:text,notnull,default:'provisioning'"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
ProviderSelectionStrategy providerselect.Strategy `bun:"type:text,notnull,default:'distribution'"`
Owner *S3Account `bun:"rel:belongs-to,join:owner_access_key=access_key,on_update:restrict,on_delete:restrict"`
}
Bucket stores S3 bucket metadata.
func (*Bucket) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type BucketReplicaSlot ¶
type BucketReplicaSlot struct {
bun.BaseModel `bun:"table:bucket_replica_slots"`
ID int64 `bun:",pk,autoincrement,identity"`
BucketID int64 `bun:",notnull"`
CopyIndex int `bun:"type:integer,notnull"`
Status BucketReplicaSlotStatus `bun:"type:text,notnull,default:'active'"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
}
BucketReplicaSlot is one logical replica position in a bucket. Data sets, copies, replacements, cleanups and observability rows all reference it, so a copy index cannot name a slot the bucket never opened.
func (*BucketReplicaSlot) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type BucketReplicaSlotStatus ¶
type BucketReplicaSlotStatus string
BucketReplicaSlotStatus tracks whether a slot still accepts new writes. A closed slot is decommissioned rather than deleted: retired data set generations still reference it, and this schema never deletes that history.
Nothing writes Decommissioned yet. Closing a slot only makes sense together with retiring the paid storage service that sits on it, and that retirement path does not exist, so lowering a bucket's replica target is refused instead.
const ( BucketReplicaSlotStatusActive BucketReplicaSlotStatus = "active" BucketReplicaSlotStatusDecommissioned BucketReplicaSlotStatus = "decommissioned" )
type BucketStatus ¶
type BucketStatus string
BucketStatus represents the lifecycle state of a bucket.
const ( BucketStatusProvisioning BucketStatus = "provisioning" BucketStatusReady BucketStatus = "ready" // BucketStatusActive is kept as a source-compatible alias for callers that // create already-provisioned test fixtures. BucketStatusActive = BucketStatusReady )
func (BucketStatus) IsAdminVisible ¶
func (s BucketStatus) IsAdminVisible() bool
IsAdminVisible reports whether the bucket belongs in the admin inventory.
func (BucketStatus) IsVisible ¶
func (s BucketStatus) IsVisible() bool
IsVisible reports whether S3 clients may discover the bucket namespace.
func (BucketStatus) IsWritable ¶
func (s BucketStatus) IsWritable() bool
IsWritable reports whether provider storage is ready for object writes.
func (BucketStatus) Valid ¶
func (s BucketStatus) Valid() bool
Valid reports whether the value is a known bucket status.
type CopyContinuationKind ¶
type CopyContinuationKind uint8
const ( CopyContinuationNone CopyContinuationKind = iota CopyContinuationTransfer CopyContinuationRegistration )
type DeploymentIdentity ¶
type DeploymentIdentity struct {
bun.BaseModel `bun:"table:deployment_identity"`
ID int16 `bun:"type:smallint,pk"`
Payer string `bun:"type:text,notnull"`
ChainID int64 `bun:"type:bigint,notnull"`
CreatedAt time.Time `bun:",notnull"`
}
func (*DeploymentIdentity) BeforeAppendModel ¶
type MultipartPart ¶
type MultipartPart struct {
bun.BaseModel `bun:"table:multipart_parts"`
ID int64 `bun:",pk,autoincrement,identity"`
UploadID string `bun:"type:text,notnull"`
PartNumber int `bun:"type:integer,notnull"`
Size int64 `bun:",notnull"`
ETag string `bun:"type:text,notnull"`
Checksum *string `bun:"type:text,nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
Upload *MultipartUpload `bun:"rel:belongs-to,join:upload_id=upload_id"`
}
MultipartPart stores metadata for a single part within a multipart upload.
func (*MultipartPart) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type MultipartStatus ¶
type MultipartStatus string
MultipartStatus represents the lifecycle state of a multipart upload.
const ( MultipartStatusInitiated MultipartStatus = "initiated" MultipartStatusCompleting MultipartStatus = "completing" MultipartStatusCompleted MultipartStatus = "completed" MultipartStatusAborted MultipartStatus = "aborted" )
type MultipartUpload ¶
type MultipartUpload struct {
bun.BaseModel `bun:"table:multipart_uploads"`
UploadID string `bun:"type:text,pk"`
BucketID int64 `bun:",notnull"`
Key string `bun:"type:text,notnull"`
ContentType string `bun:"type:text,notnull,default:'application/octet-stream'"`
Metadata map[string]string `bun:"type:jsonb,notnull,default:'{}'"`
SystemMetadata ObjectSystemMetadata `bun:"type:jsonb,notnull,default:'{}'"`
Status MultipartStatus `bun:"type:text,notnull,default:'initiated'"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
Bucket *Bucket `bun:"rel:belongs-to,join:bucket_id=id"`
}
MultipartUpload tracks an in-progress multipart upload session.
func (*MultipartUpload) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type Object ¶
type Object struct {
bun.BaseModel `bun:"table:objects"`
ID int64 `bun:",pk,autoincrement,identity"`
BucketID int64 `bun:",notnull"`
Key string `bun:"type:text,notnull"`
// CurrentVersionID names the version reads serve. It is the single authority
// for "current"; a version carries no flag of its own.
CurrentVersionID *string `bun:"type:text,nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
Bucket *Bucket `bun:"rel:belongs-to,join:bucket_id=id"`
}
Object stores the stable identity for an S3 object key.
type ObjectCache ¶
type ObjectCache struct {
bun.BaseModel `bun:"table:object_cache"`
ContentID int64 `bun:",pk"`
InCache bool `bun:",notnull"`
CacheAccessedAt *time.Time `bun:",nullzero"`
CachePresenceGeneration int64 `bun:",notnull,default:0"`
CacheOperationGeneration int64 `bun:",notnull,default:0"`
CacheActiveTaskID *int64 `bun:",nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
}
ObjectCache records local cache residency for one content payload. Two versions of identical bytes share a single entry, so eviction is driven by the content's reference count rather than by any one version.
func (*ObjectCache) BeforeAppendModel ¶
BeforeAppendModel fills unset audit timestamps on insert.
type ObjectDeletion ¶
type ObjectDeletion struct {
bun.BaseModel `bun:"table:object_deletions"`
ID int64 `bun:",pk,autoincrement,identity"`
BucketID int64 `bun:",notnull"`
ObjectID int64 `bun:",notnull"`
Key string `bun:"type:text,notnull"`
VersionID string `bun:"type:text,unique,notnull"`
ContentID *int64 `bun:",nullzero"`
Size int64 `bun:",notnull"`
DeletedAt time.Time `bun:",nullzero,notnull"`
}
ObjectDeletion is an append-only tombstone for one permanently deleted object version. Cache cleanup is not tracked here: residency is keyed by content, so the trigger is the content's reference count reaching zero rather than the removal of any single version.
type ObjectState ¶
type ObjectState string
ObjectState is a derived view of how far a version's content has travelled through the storage pipeline. It is computed from the content's copy rows on read and is deliberately not a stored column: persisting it would duplicate facts the copies already own, and the two would drift.
const ( ObjectStateCached ObjectState = "cached" ObjectStateUploading ObjectState = "uploading" ObjectStateCommitting ObjectState = "committing" ObjectStateReplicating ObjectState = "replicating" ObjectStateStored ObjectState = "stored" ObjectStateFailed ObjectState = "failed" )
type ObjectSystemMetadata ¶
type ObjectSystemMetadata struct {
CacheControl string `json:"cache_control,omitempty"`
ContentDisposition string `json:"content_disposition,omitempty"`
ContentEncoding string `json:"content_encoding,omitempty"`
ContentLanguage string `json:"content_language,omitempty"`
Expires string `json:"expires,omitempty"`
}
ObjectSystemMetadata contains S3 response headers owned by a version or upload.
type ObjectVersion ¶
type ObjectVersion struct {
bun.BaseModel `bun:"table:object_versions"`
VersionID string `bun:"type:text,pk"`
ObjectID int64 `bun:",notnull"`
BucketID int64 `bun:",notnull"`
Key string `bun:"type:text,notnull"`
ContentID *int64 `bun:",nullzero"`
Size int64 `bun:",notnull"`
ETag string `bun:"type:text,notnull"`
ContentType string `bun:"type:text,notnull,default:'application/octet-stream'"`
Metadata map[string]string `bun:"type:jsonb,notnull,default:'{}'"`
SystemMetadata ObjectSystemMetadata `bun:"type:jsonb,notnull,default:'{}'"`
MultipartUploadID *string `bun:"type:text,nullzero"`
IsDeleteMarker bool `bun:",notnull,default:false"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
// Everything below is projected by repository reads rather than stored.
// Durability and pipeline position are functions of the copy rows, cache
// residency belongs to object_cache, and "current" is the object's pointer.
IsCurrent bool `bun:",scanonly"`
Checksum string `bun:",scanonly"`
PieceCID *string `bun:"type:text,scanonly"`
RetrievalURL *string `bun:"type:text,scanonly"`
InCache bool `bun:",scanonly"`
CacheAccessedAt *time.Time `bun:",scanonly"`
InFilecoin bool `bun:",scanonly"`
State ObjectState `bun:",scanonly"`
Object *Object `bun:"rel:belongs-to,join:object_id=id"`
Bucket *Bucket `bun:"rel:belongs-to,join:bucket_id=id"`
}
ObjectVersion stores immutable per-version identity plus mutable lifecycle state.
func (*ObjectVersion) BeforeAppendModel ¶
BeforeAppendModel fills unset audit timestamps on insert.
func (*ObjectVersion) CacheKey ¶
func (v *ObjectVersion) CacheKey() string
CacheKey returns the local cache path backing this version. Residency is content-addressed, so a delete marker has no key and versions sharing bytes share one.
type S3Account ¶
type S3Account struct {
bun.BaseModel `bun:"table:s3_accounts"`
AccessKey string `bun:"type:text,pk"`
SecretKey string `bun:"type:text,notnull"`
Role auth.Role `bun:"type:text,notnull"`
IsRoot bool `bun:",notnull,default:false"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
Name string `bun:"type:text,notnull"`
}
S3Account stores S3 credentials and roles used by the VersityGW IAM adapter.
func (*S3Account) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type StorageCleanupCopy ¶
type StorageCleanupCopy struct {
bun.BaseModel `bun:"table:storage_cleanup_copies"`
ID int64 `bun:",pk,autoincrement,identity"`
ContentID int64 `bun:",notnull"`
BucketID int64 `bun:",notnull"`
CopyIndex int `bun:"type:integer,notnull"`
ProviderID types.OnChainID `bun:"type:text,notnull"`
StorageDataSetID int64 `bun:",notnull"`
DataSetID *types.OnChainID `bun:"type:text"`
ClientDataSetID *types.OnChainID `bun:"type:text"`
PieceID types.OnChainID `bun:"type:text,notnull"`
PieceCID string `bun:"type:text,notnull"`
Checksum string `bun:"type:text,notnull"`
RetrievalURL *string `bun:"type:text,nullzero"`
Status StorageCleanupCopyStatus `bun:"type:text,notnull,default:'pending'"`
DeleteTxHash *string `bun:"type:text,nullzero"`
LastError *string `bun:"type:text,nullzero"`
ScheduledAt *time.Time `bun:",nullzero"`
RemovedAt *time.Time `bun:",nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
}
StorageCleanupCopy tracks PDP cleanup for one committed storage copy.
func (*StorageCleanupCopy) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type StorageCleanupCopyStatus ¶
type StorageCleanupCopyStatus string
const ( StorageCleanupCopyStatusPending StorageCleanupCopyStatus = "pending" StorageCleanupCopyStatusDeleteScheduled StorageCleanupCopyStatus = "delete_scheduled" StorageCleanupCopyStatusRemoved StorageCleanupCopyStatus = "removed" StorageCleanupCopyStatusFailed StorageCleanupCopyStatus = "failed" StorageCleanupCopyStatusUnsupported StorageCleanupCopyStatus = "unsupported" )
type StorageContent ¶
type StorageContent struct {
bun.BaseModel `bun:"table:storage_contents"`
ID int64 `bun:",pk,autoincrement,identity"`
BucketID int64 `bun:",notnull"`
Checksum string `bun:"type:text,notnull"`
ContentSize int64 `bun:",notnull"`
PieceCID *string `bun:"type:text,nullzero"`
// RequestedCopies is the durability target frozen when the content is first
// created. Later bucket-policy changes do not rewrite this target, and a
// deduplicated write inherits it.
RequestedCopies int `bun:"type:integer,notnull"`
ErrorMessage *string `bun:"type:text,nullzero"`
AcceptedAt *time.Time `bun:",nullzero"`
CleanupGeneration int64 `bun:",notnull,default:0"`
CleanupTaskID *int64 `bun:",nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
Bucket *Bucket `bun:"rel:belongs-to,join:bucket_id=id"`
}
StorageContent is the identity of one bucket-scoped byte payload. Object versions point at it, copies place it with providers, and dedup is a lookup on (bucket_id, checksum, content_size) rather than a scan.
func (*StorageContent) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type StorageCopy ¶
type StorageCopy struct {
bun.BaseModel `bun:"table:storage_copies"`
ID int64 `bun:",pk,autoincrement,identity"`
ContentID int64 `bun:",notnull"`
BucketID int64 `bun:",notnull"`
// ContentSize repeats the content size so the Store bound stays a local
// check; a composite foreign key keeps the repetition from drifting.
ContentSize int64 `bun:",notnull"`
StorageDataSetID int64 `bun:",notnull"`
CopyIndex int `bun:"type:integer,notnull"`
ProviderID types.OnChainID `bun:"type:text,notnull"`
PieceID *types.OnChainID `bun:"type:text"`
TransferMethod StorageCopyTransferMethod `bun:"type:text,notnull"`
Status StorageCopyStatus `bun:"type:text,notnull,default:'pending'"`
RetrievalURL *string `bun:"type:text,nullzero"`
// IsNewDataSet is derived by repository reads from the data set's creator.
IsNewDataSet bool `bun:",scanonly"`
CommitReadyAt *time.Time `bun:",nullzero"`
// CommitRequestID names the commit request the copy belongs to, and
// CommitPosition its place once that request is signed. A committed copy
// repeats its request's confirmed status in CommitRequestStatus, which a
// composite foreign key ties to the request.
CommitRequestID *string `bun:"type:text,nullzero"`
CommitPosition *int `bun:"type:integer"`
CommitRequestStatus *string `bun:"type:text,nullzero"`
IngressBytesTransferred int64 `bun:",notnull,default:0"`
IngressStoreAttempt int `bun:"type:integer,notnull,default:0"`
ProgressUpdatedAt *time.Time `bun:",nullzero"`
WorkGeneration int64 `bun:",notnull,default:0"`
ActiveTaskID *int64 `bun:",nullzero"`
LastError *string `bun:"type:text,nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
DataSetID *types.OnChainID `bun:"type:text,scanonly"`
// The copy's commit request is projected by repository reads. These fields
// are not columns on the copy table.
CommitState *string `bun:",scanonly"`
CommitTaskID *int64 `bun:",scanonly"`
CommitPieceCount *int `bun:",scanonly"`
CommitSentAt *time.Time `bun:",scanonly"`
CommitTxHash *string `bun:",scanonly"`
CommitSubmitError *string `bun:",scanonly"`
CommitConfirmedTxHash *string `bun:",scanonly"`
CommitAttentionCode *string `bun:",scanonly"`
CommitAttentionAt *time.Time `bun:",scanonly"`
Content *StorageContent `bun:"rel:belongs-to,join:content_id=id"`
StorageSet *StorageDataSet `bun:"rel:belongs-to,join:storage_data_set_id=id"`
}
StorageCopy places one content payload on one data set generation. Store progress belongs to the concrete transfer, not the shared content.
func (*StorageCopy) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
func (StorageCopy) CommitDecidedByRequest ¶
func (c StorageCopy) CommitDecidedByRequest() bool
CommitDecidedByRequest reports whether only the copy's request may settle it.
func (StorageCopy) CommitPinned ¶
func (c StorageCopy) CommitPinned() bool
CommitPinned reports whether the copy belongs to a signed commit request that is not settled. Until it is, only the request decides the copy's outcome: a signed request can be sent whole or not at all.
func (StorageCopy) CommitSealed ¶
func (c StorageCopy) CommitSealed() bool
CommitSealed reports whether the copy has a position in a signed commit request.
func (StorageCopy) ContinuationKind ¶
func (c StorageCopy) ContinuationKind() CopyContinuationKind
ContinuationKind identifies which owner resumes incomplete copy work.
func (StorageCopy) WorkTaskID ¶
func (c StorageCopy) WorkTaskID() *int64
WorkTaskID is the task currently responsible for the copy: its own transfer task, or, while it waits in a commit request, that request's task.
type StorageCopyStatus ¶
type StorageCopyStatus string
const ( StorageCopyStatusPending StorageCopyStatus = "pending" StorageCopyStatusPieceReady StorageCopyStatus = "piece_ready" StorageCopyStatusCommitting StorageCopyStatus = "committing" StorageCopyStatusCommitted StorageCopyStatus = "committed" StorageCopyStatusFailed StorageCopyStatus = "failed" )
type StorageCopyTransferMethod ¶
type StorageCopyTransferMethod string
const ( StorageCopyTransferMethodIngress StorageCopyTransferMethod = "ingress" StorageCopyTransferMethodPeerPull StorageCopyTransferMethod = "peer_pull" StorageCopyTransferMethodCacheRestore StorageCopyTransferMethod = "cache_restore" )
func (StorageCopyTransferMethod) Valid ¶
func (m StorageCopyTransferMethod) Valid() bool
Valid reports whether the value is a known transfer method.
type StorageDataSet ¶
type StorageDataSet struct {
bun.BaseModel `bun:"table:storage_data_sets"`
ID int64 `bun:",pk,autoincrement,identity"`
BucketID int64 `bun:",notnull"`
ProviderID types.OnChainID `bun:"type:text,notnull"`
CopyIndex int `bun:"type:integer,notnull"`
Generation int64 `bun:",notnull,default:1"`
IsCurrent bool `bun:",notnull"`
DataSetID *types.OnChainID `bun:"type:text"`
ClientDataSetID *types.OnChainID `bun:"type:text"`
Status StorageDataSetStatus `bun:"type:text,notnull,default:'pending'"`
TxHash *string `bun:"type:text,nullzero"`
ConfirmedTxHash *string `bun:"type:text,nullzero"`
CreateStatusURL *string `bun:"type:text,nullzero"`
CreatedByContentID *int64 `bun:",nullzero"`
LastError *string `bun:"type:text,nullzero"`
EnsureTaskID *int64 `bun:",nullzero"`
RetirementGeneration int64 `bun:",notnull,default:0"`
RetirementTaskID *int64 `bun:",nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
CreationRejection json.RawMessage `bun:"type:jsonb,nullzero"`
Bucket *Bucket `bun:"rel:belongs-to,join:bucket_id=id"`
CreatedByContent *StorageContent `bun:"rel:belongs-to,join:created_by_content_id=id"`
}
StorageDataSet records the bucket ownership of a provider-scoped data set. CopyIndex names the logical replica slot, which can own several physical generations while a provider replacement is in flight. IsCurrent selects the generation that accepts new writes; replaced generations stay readable until they are verifiably retired.
func (*StorageDataSet) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type StorageDataSetStatus ¶
type StorageDataSetStatus string
const ( StorageDataSetStatusPending StorageDataSetStatus = "pending" StorageDataSetStatusCreating StorageDataSetStatus = "creating" StorageDataSetStatusReady StorageDataSetStatus = "ready" StorageDataSetStatusDraining StorageDataSetStatus = "draining" StorageDataSetStatusRetired StorageDataSetStatus = "retired" )
type Task ¶
type Task struct {
bun.BaseModel `bun:"table:tasks"`
ID int64 `bun:",pk,autoincrement,identity"`
Type TaskType `bun:"type:text,notnull"`
InputVersion int `bun:"type:integer,notnull"`
// The identity is (Type, SubjectType, SubjectKey, Generation). A nil
// Generation is never deduplicated.
SubjectType string `bun:"type:text,notnull"`
SubjectKey string `bun:"type:text,notnull"`
Generation *int64 `bun:",nullzero"`
RetryOfTaskID *int64 `bun:",nullzero"`
Input json.RawMessage `bun:"input_json,type:jsonb,notnull"`
Checkpoint json.RawMessage `bun:"checkpoint_json,type:jsonb,nullzero"`
Runtime json.RawMessage `bun:"runtime_json,type:jsonb,notnull"`
Status TaskStatus `bun:"type:text,notnull,default:'pending'"`
ResumeMode TaskResumeMode `bun:"type:text,notnull,default:'execute'"`
AvailableAt time.Time `bun:",nullzero,notnull"`
WaitReason *string `bun:"type:text,nullzero"`
RetryCount int `bun:"type:integer,notnull,default:0"`
FailureReason *string `bun:"type:text,nullzero"`
LastError *string `bun:"type:text,nullzero"`
StatusMessage *string `bun:"type:text,nullzero"`
ClaimGeneration int64 `bun:",notnull,default:0"`
LeaseUntil *time.Time `bun:",nullzero"`
FinishedAt *time.Time `bun:",nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
WorkStartedAt *time.Time `bun:",nullzero"`
AcknowledgedAt *time.Time `bun:",nullzero"`
SupersededAt *time.Time `bun:",nullzero"`
}
Task is one execution round. Finished rounds stay in the table as history; the live_tasks view holds the rounds that still need work or attention. Domain tables own external-effect safety independently of task retention.
func (*Task) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type TaskEvent ¶
type TaskEvent struct {
bun.BaseModel `bun:"table:task_events"`
ID int64 `bun:",pk,autoincrement,identity"`
TaskID int64 `bun:",notnull"`
Type string `bun:"type:text,notnull"`
Details json.RawMessage `bun:"type:jsonb,notnull"`
CreatedAt time.Time `bun:",nullzero,notnull"`
}
TaskEvent is a diagnostic entry of one task round. Its ID orders the round's events.
type TaskObservation ¶
TaskObservation identifies one policy-managed observation window.
type TaskResumeMode ¶
type TaskResumeMode string
TaskResumeMode controls whether a handler may initiate an external effect.
const ( TaskResumeModeExecute TaskResumeMode = "execute" TaskResumeModeRecover TaskResumeMode = "recover" )
type TaskRuntime ¶
type TaskRuntime struct {
OperationKey string `json:"operation_key,omitempty"`
OperationStartedAt *time.Time `json:"operation_started_at,omitempty"`
LastAdmittedAttempt int `json:"last_admitted_attempt,omitempty"`
Observation *TaskObservation `json:"observation,omitempty"`
}
TaskRuntime holds durable engine state, independent of diagnostic events.
type TaskSchedule ¶
type TaskStatus ¶
type TaskStatus string
TaskStatus is the complete task lifecycle.
const ( TaskStatusPending TaskStatus = "pending" TaskStatusRunning TaskStatus = "running" TaskStatusCompleted TaskStatus = "completed" TaskStatusFailed TaskStatus = "failed" TaskStatusCancelled TaskStatus = "cancelled" )
type TaskType ¶
type TaskType string
TaskType is the only persistent classification of asynchronous work.
const ( TaskTypeBucketProvision TaskType = "bucket_provision" TaskTypeUploadPlan TaskType = "upload_plan" TaskTypeStorageDataSetEnsure TaskType = "storage_dataset_ensure" TaskTypeStorageTransferPlan TaskType = "storage_transfer_plan" TaskTypeStorageStore TaskType = "storage_store" TaskTypeStoragePull TaskType = "storage_pull" TaskTypeStorageCommit TaskType = "storage_commit" TaskTypeProviderReplacementCoordinate TaskType = "provider_replacement_coordinate" TaskTypeCacheCapacityReconcile TaskType = "cache_capacity_reconcile" TaskTypeCacheEvict TaskType = "cache_evict" TaskTypeCacheReconcileDurability TaskType = "cache_reconcile_durability" TaskTypeStorageCleanup TaskType = "storage_cleanup" TaskTypeStorageDataSetRetire TaskType = "storage_dataset_retire" TaskTypeWalletOperation TaskType = "wallet_operation" TaskTypeObservabilityRefresh TaskType = "observability_refresh" TaskTypeApprovedProviderRefresh TaskType = "approved_provider_refresh" TaskTypeEndorsedProviderRefresh TaskType = "endorsed_provider_refresh" TaskTypeProviderUploadSpeedTest TaskType = "provider_upload_speed_test" )
func RecurringSystemTaskTypes ¶
func RecurringSystemTaskTypes() []TaskType
RecurringSystemTaskTypes returns the scheduled maintenance task types.
func (TaskType) IsRecurringSystem ¶
IsRecurringSystem reports whether the task is a perpetual maintenance loop rather than a finite user or domain operation.
type WalletOperation ¶
type WalletOperation struct {
bun.BaseModel `bun:"table:wallet_operations"`
ID int64 `bun:",pk,autoincrement,identity"`
Type WalletOperationType `bun:"type:text,notnull"`
ClientRequestID string `bun:"type:text,notnull"`
Amount string `bun:"type:text,notnull"`
Status WalletOperationStatus `bun:"type:text,notnull,default:'pending'"`
TxHash *string `bun:"type:text,nullzero"`
SignedTransaction []byte `bun:"type:bytea,nullzero" json:"-"`
LastError *string `bun:"type:text,nullzero"`
BroadcastAttemptedAt *time.Time `bun:",nullzero"`
TaskID *int64 `bun:",nullzero"`
StartedAt *time.Time `bun:",nullzero"`
SubmittedAt *time.Time `bun:",nullzero"`
CompletedAt *time.Time `bun:",nullzero"`
CreatedAt time.Time `bun:",nullzero,notnull"`
UpdatedAt time.Time `bun:",nullzero,notnull"`
}
func (*WalletOperation) BeforeAppendModel ¶
BeforeAppendModel stamps the audit columns on insert. The database has no timestamp default, so every row is written with one encoding instead of two that sort against each other inside the same second.
type WalletOperationStatus ¶
type WalletOperationStatus string
const ( WalletOperationStatusPending WalletOperationStatus = "pending" WalletOperationStatusSubmitted WalletOperationStatus = "submitted" WalletOperationStatusConfirmed WalletOperationStatus = "confirmed" WalletOperationStatusFailed WalletOperationStatus = "failed" WalletOperationStatusUnknown WalletOperationStatus = "unknown" )
type WalletOperationType ¶
type WalletOperationType string
const ( WalletOperationTypeFund WalletOperationType = "fund" WalletOperationTypeWithdraw WalletOperationType = "withdraw" WalletOperationTypeApprove WalletOperationType = "approve" )