Documentation
¶
Index ¶
- Constants
- Variables
- type AcquireReaderOptions
- type CapacityEvictionResult
- type CapacityObservation
- type DeletionResult
- type MaterializationLease
- type Options
- type PartsDeletionResult
- type ReaderLease
- 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) 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) 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 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 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) 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. The conditional update is also the cross-dialect write lock used by the rest of the fencing model.
func (*Service) PurgeExpiredReaderLeases ¶
func (*Service) ReleaseMaterialization ¶
func (*Service) ReleaseReader ¶
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. Active readers pin the location instead of merely delaying its physical deletion, which preserves capacity eviction's LRU contract.
func (*Service) RequestExpiredLocationDeletion ¶
func (s *Service) RequestExpiredLocationDeletion(ctx context.Context, locationID string, cutoff int64) (DeletionResult, error)
RequestExpiredLocationDeletion atomically rechecks retention eligibility after fencing concurrent readers and cache-entry replacement transactions.