catalogsummary

package
v0.0.0-...-93c756f Latest Latest
Warning

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

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

Documentation

Overview

Package catalogsummary owns the Motors "derived catalog summary" background worker. Every replica ticks, but only the one that wins a patterns.Mutex recomputes the summary (sqlc against the framework pool) and refreshes it in Valkey. GET /v1/catalog/summary then reads Valkey only — no Postgres on that path.

This is deliberately NOT a job platform — see VPQ-TO-GENERAL-JOB-QUEUE.md. It is "one replica should refresh this shared derived cache" (VALKEY-HEAVY).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Interval between refresh attempts.
	Interval time.Duration
	// LockTTL bounds how long a replica may hold the refresh lock.
	LockTTL time.Duration
	// CacheTTL is how long the derived summary lives in Valkey.
	CacheTTL time.Duration
}

Options are construction-time defaults.

type Refresher

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

Refresher is the Caerus Motors catalog-summary refresher (a Runnable).

func New

func New(opts Options) *Refresher

New creates the refresher (not yet started).

func (*Refresher) GetDependencies

func (c *Refresher) GetDependencies() []string

GetDependencies implements cf.Dependencies.

func (*Refresher) GetInitOrderStage

func (c *Refresher) GetInitOrderStage() cf.Stage

GetInitOrderStage implements cf.CaerusComponent — data plane with postgres/valkey.

func (*Refresher) Init

func (c *Refresher) Init(ctx context.Context, fw *cf.CaerusFramework) error

Init resolves peers and builds the sqlc query set against the framework pool.

func (*Refresher) Name

func (c *Refresher) Name() string

Name implements cf.CaerusComponent.

func (*Refresher) Run

func (c *Refresher) Run(ctx context.Context) error

Run implements cf.Runnable — ticks until ctx is canceled. Each tick tries to become the refresher via patterns.Mutex; losing replicas skip silently.

func (*Refresher) Shutdown

func (c *Refresher) Shutdown(ctx context.Context) error

Shutdown unsubscribes logs.

Jump to

Keyboard shortcuts

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