Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscardOrphanedContent ¶
func DiscardOrphanedContent( ctx context.Context, c cache.Cache, gate *cacheaccess.Gate, tracker *cacheaccess.Tracker, repository orphanDiscardRepository, bucketName string, contentID int64, ) (bool, error)
DiscardOrphanedContent deletes content no object version has ever named, together with any file cached under its key. It holds the deletion gate on the content key, so it cannot interleave with a write that is committing those bytes and naming the content. It reports whether the content was deleted.
Types ¶
type CacheReleaseOutcome ¶
type CacheReleaseOutcome string
const ( CacheReleaseRetained CacheReleaseOutcome = "retained" CacheReleaseReleased CacheReleaseOutcome = "released" )
func ReleaseContentCache ¶
func ReleaseContentCache( ctx context.Context, c cache.Cache, gate *cacheaccess.Gate, tracker *cacheaccess.Tracker, repository cacheReleaseRepository, bucketName string, contentID int64, beforeDelete func(), ) (CacheReleaseOutcome, error)
ReleaseContentCache removes the cached bytes of one content payload after the last object version referencing it has been permanently deleted.
Cache residency is content-addressed, so several versions can share a single file. Deleting one of them must leave the file alone; only the disappearance of the final reference releases it. The reference decision is rechecked while the content row and deletion gate are both held.
The deletion gate is held on the content key for the same reason: two versions of identical bytes contend for one file, not one file each.
beforeDelete runs inside the authorized release transaction and must not perform repository writes or wait for locks.