manager

package
v2.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheEntry

type CacheEntry struct {
	OutputURI string
	Metadata  *cacheservicepb.Metadata
}

type Manager

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

Manager owns the cache service's core behavior:

  • read/write cached outputs
  • maintain cache metadata timestamps
  • coordinate serialized cache population with reservations

The service layer stays thin and only translates V2 transport requests into manager calls. Repository implementations only persist rows. The policy of "who gets to populate cache and when" lives here.

func New

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, request *cacheservicepb.DeleteCacheRequest) error

Delete removes the cache metadata row for a key.

This does not delete the referenced object-storage blob. The caller may be pointing at a shared URI, and blob lifecycle is better handled separately.

func (*Manager) Get

Get returns the materialized cache entry for the given key, if one exists.

func (*Manager) GetOrExtendReservation

func (m *Manager) GetOrExtendReservation(ctx context.Context, request *cacheservicepb.GetOrExtendReservationRequest, now time.Time) (*cacheservicepb.Reservation, error)

GetOrExtendReservation returns the active reservation for a cache key, creating or refreshing it when the caller is allowed to own it.

This is the coordination path for serialized cache population. On a cache miss, only the active owner should execute and publish the result; other callers observe the current reservation and wait for the cache entry to appear.

func (*Manager) Put

Put stores or overwrites the materialized cache entry for a key.

In OSS V2 we only persist output URIs. The actual output payload continues to live in object storage; cache service stores the lookup record plus metadata.

func (*Manager) ReleaseReservation

func (m *Manager) ReleaseReservation(ctx context.Context, request *cacheservicepb.ReleaseReservationRequest) error

ReleaseReservation releases ownership for serialized cache population.

Missing reservations are treated as already-released so callers can clean up idempotently.

Jump to

Keyboard shortcuts

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