chunkcatalog

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package chunkcatalog implements a bounded LRU recording chunks known to be present in the CacheStore. Pure hot-path optimization; CacheStore is the source of truth.

The catalog is presence-only: it tracks whether a chunk's path is known to exist in the cachestore. No size or metadata is stored. chunk.Path encodes (origin_id, bucket, key, etag, chunk_size), so a path hit means the cachestore contains bytes for this exact version of this chunk - the path encoding IS the integrity statement, and a stale entry whose backing bytes have been deleted is self-healing (cachestore.GetChunk returns ErrNotFound, caller Forget()s the entry and falls through to the stat path).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

Catalog is a bounded LRU keyed on chunk.Key.Path().

func New

func New(maxEntries int, log *slog.Logger) *Catalog

New constructs a Catalog. The log is used at debug level for per-call hit / miss / record / forget / evict trace lines via slog.LogAttrs so the cost when filtered out (operator runs at info or higher) is just the handler's level check. Passing nil falls back to slog.Default().

func (*Catalog) Forget

func (c *Catalog) Forget(k chunk.Key)

Forget removes the entry if present.

func (*Catalog) Lookup

func (c *Catalog) Lookup(k chunk.Key) bool

Lookup reports whether the chunk is known to be present in the cachestore. Bumps the LRU position on hit.

This is the hottest log site in orca: it fires on every chunk read attempt. The LogAttrs path ensures attribute-evaluation cost is zero when the configured level is above Debug.

func (*Catalog) Record

func (c *Catalog) Record(k chunk.Key)

Record marks the chunk as present.

The catalog is presence-only: callers do not pass (and the catalog does not store) any size or freshness metadata. chunk.Path encodes (origin_id, bucket, key, etag, chunk_size), so a Recorded key is sufficient to know which exact version is in the cachestore. See the package docstring for the rationale.

Jump to

Keyboard shortcuts

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