Documentation
¶
Overview ¶
Package artifacts coordinates protected content with optimization retention.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeletionMetadata ¶
type DeletionMetadata interface {
GetArtifact(context.Context, optimization.ArtifactRef) (optimization.ArtifactRetention, error)
GetExperiment(context.Context, id.ID) (optimization.Experiment, error)
Transact(context.Context, func(optimization.Transaction) error) error
}
DeletionMetadata is the transactional metadata required for deletion recovery.
type DeletionReceipt ¶
type DeletionReceipt struct {
BindingDigest string
RequestID string
Actor optimization.IdentityRef
Reason string
}
DeletionReceipt identifies a durable tombstone verified by the content adapter. A missing object or successful transport response alone is not a receipt.
type DeletionService ¶
type DeletionService struct {
// contains filtered or unexported fields
}
DeletionService invalidates evidence before attempting physical deletion. It makes one provider call per invocation. Pending requests survive crashes and can be retried through Recover with fresh grants for the saved original actor.
func NewDeletionService ¶
func NewDeletionService(metadata DeletionMetadata, provider Tombstoner, authorizer optimization.Authorizer, resolver optimization.IdentityResolver) (*DeletionService, error)
NewDeletionService requires explicit storage, provider and host authority.
func (*DeletionService) Delete ¶
func (s *DeletionService) Delete(ctx context.Context, request optimization.ArtifactDeletion) error
Delete accepts a host-attributed command. The host must bind Actor to the authenticated caller, never accept a model-supplied or untrusted subject.
func (*DeletionService) Recover ¶
func (s *DeletionService) Recover(ctx context.Context, ref optimization.ArtifactRef) error
Recover resumes only a previously saved deletion. It never creates a request or substitutes the recovering worker's identity for the original actor.
type Recovery ¶
type Recovery struct {
// contains filtered or unexported fields
}
Recovery processes a single page per call. The host owns scheduling, scope enumeration, continuation persistence and reporting failures. Providers must honor cancellation; no background goroutine is started to abandon a delete.
func NewRecovery ¶
func NewRecovery(metadata RecoveryMetadata, deletion *DeletionService, actor optimization.IdentityRef, timeout time.Duration) (*Recovery, error)
NewRecovery requires the host's retention identity for new expiry requests. Pending requests retain their saved actor. A zero timeout selects 30 seconds; an explicit per-item timeout must be positive and at most 30 seconds.
func (*Recovery) RunPage ¶
func (r *Recovery) RunPage(ctx context.Context, cutoff time.Time, query optimization.PageQuery) (RecoveryResult, error)
RunPage uses one fixed cutoff throughout a sweep. A failed call must be retried with the same input cursor; successful item operations are idempotent. A successful call may still contain individual failures. Start a fresh sweep after reaching an empty NextCursor so failed or newly eligible rows are found. Page limits bound provider calls, not the store's current snapshot hydration.
type RecoveryMetadata ¶
type RecoveryMetadata interface {
ListArtifactWork(context.Context, time.Time, optimization.PageQuery) (optimization.Page[optimization.ArtifactRetention], error)
GetArtifact(context.Context, optimization.ArtifactRef) (optimization.ArtifactRetention, error)
}
RecoveryMetadata discovers deletion work within one exact host scope.
type RecoveryOutcome ¶
type RecoveryOutcome struct {
Ref optimization.ArtifactRef
Err error
}
RecoveryOutcome records one attempted reconciliation, including its failure.
type RecoveryResult ¶
type RecoveryResult struct {
Outcomes []RecoveryOutcome
NextCursor string
}
RecoveryResult advances only a fully visited page. Individual errors remain in Outcomes and must be retried by a later sweep starting with an empty cursor.
type RetainedReader ¶
type RetainedReader struct {
// contains filtered or unexported fields
}
RetainedReader checks both durable eligibility and freshly verified content. Its final check establishes an observation point, not a lease over returned bytes. Decision commits must still use transactional retention checks.
func NewRetainedReader ¶
func NewRetainedReader(metadata RetentionReader, provider optimization.ArtifactReader, maxBytes int64, now func() time.Time) (*RetainedReader, error)
NewRetainedReader requires a provider that enforces current artifact grants. The maximum byte limit applies through the shared content verifier.
func (*RetainedReader) Get ¶
func (r *RetainedReader) Get(ctx context.Context, ref optimization.ArtifactRef) (optimization.Artifact, error)
Get refuses missing, expired or invalidated evidence, including deletion that commits while content is being fetched. Provider retention cannot override the dates registered in the metadata transaction.
type RetentionReader ¶
type RetentionReader interface {
GetArtifact(context.Context, optimization.ArtifactRef) (optimization.ArtifactRetention, error)
}
RetentionReader reads exact-scope artifact metadata without returning bytes.
type Tombstoner ¶
type Tombstoner interface {
Tombstone(context.Context, optimization.ArtifactDeletion) (DeletionReceipt, error)
}
Tombstoner must check current provider grants and persist a permanent fence against delayed uploads, including for an absent object. Identical requests are idempotent. Return a receipt only after verifying the stored tombstone's exact reference, request, actor and reason. Unknown outcomes must remain errors.