Help us shape the future of Go! Take the 2026 Go Developer Survey

objectdeletion

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL