Documentation
¶
Index ¶
- Constants
- Variables
- type AcquireReaderOptions
- type CapacityEvictionResult
- type CapacityObservation
- type DeletionResult
- type MaterializationLease
- type Options
- type PartsDeletionResult
- type ReaderLease
- type ReaderSnapshot
- type Service
- func (s *Service) AcquireMaterialization(ctx context.Context, locationID string) (*MaterializationLease, error)
- func (s *Service) AcquireReader(ctx context.Context, cacheEntryID string, options AcquireReaderOptions) (*ReaderLease, error)
- func (s *Service) ClaimPartsDeletion(ctx context.Context, locationID string) (PartsDeletionResult, error)
- func (s *Service) ExtendDirectReader(ctx context.Context, leaseID string) error
- func (s *Service) FenceDetachedLocation(ctx context.Context, db *ent.Client, locationID string) (DeletionResult, error)
- func (s *Service) FinishMaterialization(ctx context.Context, locationID, token string) error
- func (s *Service) InspectReader(ctx context.Context, cacheEntryID string, options AcquireReaderOptions) (*ReaderSnapshot, error)
- func (s *Service) MarkMaterializationUnsupported(ctx context.Context, locationID, token string) error
- func (s *Service) MaterializationActive(location *ent.StorageLocation) bool
- func (s *Service) PurgeDanglingCacheEntry(ctx context.Context, cacheEntryID, locationID string) (bool, error)
- func (s *Service) PurgeDanglingCacheEntryIfUnchanged(ctx context.Context, cacheEntryID string, observed *ent.StorageLocation) (bool, error)
- func (s *Service) PurgeExpiredReaderLeases(ctx context.Context) (int, error)
- func (s *Service) ReleaseMaterialization(ctx context.Context, locationID, token string) error
- func (s *Service) ReleaseReader(ctx context.Context, leaseID string) error
- func (s *Service) ReleaseReaders(ctx context.Context, leaseIDs []string) (int, error)
- func (s *Service) RenewMaterialization(ctx context.Context, locationID, token string) error
- func (s *Service) RenewReader(ctx context.Context, leaseID string) error
- func (s *Service) RequestCapacityEviction(ctx context.Context, observed CapacityObservation) (CapacityEvictionResult, error)
- func (s *Service) RequestExpiredLocationDeletion(ctx context.Context, locationID string, cutoff int64) (DeletionResult, error)
- func (s *Service) RequestLocationDeletion(ctx context.Context, locationID string, deleteCacheEntries, requireOrphan bool) (DeletionResult, error)
Constants ¶
const ( ReaderLeaseDuration = 2 * time.Minute LeaseRenewalInterval = 30 * time.Second DirectDownloadLeaseDuration = 10 * time.Minute DeletionGracePeriod = DirectDownloadLeaseDuration MaterializationLeaseDuration = 2 * time.Minute )
Variables ¶
var ( ErrDirectRepresentation = errors.New("storage location has no direct-download representation") ErrReaderLeaseLost = errors.New("storage reader lease was lost") ErrMaterializationLeaseHeld = errors.New("materialization lease is already held") ErrMaterializationLeaseLost = errors.New("materialization lease was lost") )
Functions ¶
This section is empty.
Types ¶
type AcquireReaderOptions ¶
type AcquireReaderOptions struct {
Direct bool
}
type CapacityEvictionResult ¶
type CapacityObservation ¶
type DeletionResult ¶
type DeletionResult struct {
Task *ent.StorageDeletion
Fenced bool
Finalized bool
}
type MaterializationLease ¶
type MaterializationLease struct {
Location *ent.StorageLocation
Token string
RenewAfter time.Duration
}
type Options ¶
type Options struct {
Now func() time.Time
ReaderLeaseDuration time.Duration
LeaseRenewalInterval time.Duration
DirectDownloadLeaseDuration time.Duration
DeletionGracePeriod time.Duration
MaterializationLeaseDuration time.Duration
// MaterializationDisabled marks deployments without a storage composer, where
// locations never merge and parts deletion never runs; reader acquisitions
// then skip the parts row lock regardless of part count.
MaterializationDisabled bool
ReaderAcquireRetryBackoff time.Duration
}
type PartsDeletionResult ¶
type PartsDeletionResult struct {
Task *ent.StorageDeletion
PartCount int
}
type ReaderLease ¶
type ReaderLease struct {
ID string
Location *ent.StorageLocation
Scope storagereaderlease.Scope
ExpiresAt time.Time
RenewAfter time.Duration
}
type ReaderSnapshot ¶ added in v1.1.2
type ReaderSnapshot struct {
Location *ent.StorageLocation
Scope storagereaderlease.Scope
}
ReaderSnapshot is the authoritative, lease-free view used by metadata-only requests. It deliberately shares representation availability rules with AcquireReader while leaving payload protection to callers that acquire a real ReaderLease.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AcquireMaterialization ¶
func (*Service) AcquireReader ¶
func (s *Service) AcquireReader(ctx context.Context, cacheEntryID string, options AcquireReaderOptions) (*ReaderLease, error)
func (*Service) ClaimPartsDeletion ¶
func (*Service) ExtendDirectReader ¶
func (*Service) FenceDetachedLocation ¶
func (*Service) FinishMaterialization ¶
func (*Service) InspectReader ¶ added in v1.1.2
func (s *Service) InspectReader(ctx context.Context, cacheEntryID string, options AcquireReaderOptions) (*ReaderSnapshot, error)
func (*Service) MarkMaterializationUnsupported ¶
func (*Service) MaterializationActive ¶
func (s *Service) MaterializationActive(location *ent.StorageLocation) bool
func (*Service) PurgeDanglingCacheEntry ¶
func (s *Service) PurgeDanglingCacheEntry(ctx context.Context, cacheEntryID, locationID string) (bool, error)
PurgeDanglingCacheEntry removes an entry only if it still references the storage location that was confirmed missing. The location is fenced only after its final cache entry has been detached.
func (*Service) PurgeDanglingCacheEntryIfUnchanged ¶
func (s *Service) PurgeDanglingCacheEntryIfUnchanged(ctx context.Context, cacheEntryID string, observed *ent.StorageLocation) (bool, error)
PurgeDanglingCacheEntryIfUnchanged removes an entry only while the storage representation and materialization ownership still match the state that was inspected before the missing object was confirmed. Reader leases no longer invalidate the observation on merged locations; active readers are handled by the fence's lease recheck and deletion grace instead.
func (*Service) PurgeExpiredReaderLeases ¶
func (*Service) ReleaseMaterialization ¶
func (*Service) ReleaseReader ¶
func (*Service) ReleaseReaders ¶ added in v1.1.2
func (*Service) RenewMaterialization ¶
func (*Service) RenewReader ¶
func (*Service) RequestCapacityEviction ¶
func (s *Service) RequestCapacityEviction(ctx context.Context, observed CapacityObservation) (CapacityEvictionResult, error)
RequestCapacityEviction removes a location only while its access observation is still current. Committed active readers pin the location, preserving capacity eviction's LRU contract; an acquisition still in flight may be missed, in which case the fence defers physical deletion instead.
func (*Service) RequestExpiredLocationDeletion ¶
func (s *Service) RequestExpiredLocationDeletion(ctx context.Context, locationID string, cutoff int64) (DeletionResult, error)
RequestExpiredLocationDeletion atomically rechecks retention eligibility against active reader leases and cache-entry replacement transactions.