Documentation
¶
Index ¶
- type CacheEntry
- type Manager
- func (m *Manager) Delete(ctx context.Context, request *cacheservicepb.DeleteCacheRequest) error
- func (m *Manager) Get(ctx context.Context, request *cacheservicepb.GetCacheRequest) (*CacheEntry, error)
- func (m *Manager) GetOrExtendReservation(ctx context.Context, request *cacheservicepb.GetOrExtendReservationRequest, ...) (*cacheservicepb.Reservation, error)
- func (m *Manager) Put(ctx context.Context, request *cacheservicepb.PutCacheRequest) error
- func (m *Manager) ReleaseReservation(ctx context.Context, request *cacheservicepb.ReleaseReservationRequest) error
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 New(cfg *cacheconfig.Config, outputs interfaces.CachedOutputRepo, reservations interfaces.ReservationRepo) *Manager
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 ¶
func (m *Manager) Get(ctx context.Context, request *cacheservicepb.GetCacheRequest) (*CacheEntry, error)
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 ¶
func (m *Manager) Put(ctx context.Context, request *cacheservicepb.PutCacheRequest) error
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.