sinks

package
v0.0.55 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

README

sinks

The sink abstraction layer for the API server. This package is the single point of dispatch for all write and credential-lookup operations — callers elsewhere in the server import from here rather than from any concrete sink implementation directly.

On startup, the package inspects the configuration and initializes whichever sinks are enabled. Two sinks are currently supported: PostgreSQL for persistent storage and querying, and OpenTelemetry for shipping score results to an OTLP-compatible backend. Each is optional and independently configured; any combination of zero, one, or both may be active at once. Score submission is forwarded to every enabled sink on each call, and errors from any sink are propagated back to the caller. Credential lookups are satisfied by the database if it is configured, and fall back to reading inline user lists from the config file otherwise.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddScore

func AddScore(
	ctx context.Context,
	sinks config.Sinks,
	db *pgxpool.Pool,
	score types.Score,
) error

AddScore sends the score to every configured sink.

func GetRandomUser

func GetRandomUser(
	ctx context.Context,
	cfg *config.APIConfigSpec,
	db *pgxpool.Pool,
	userListID types.UserListName,
	teamNum types.TeamNum,
) (types.User, error)

GetRandomUser returns a random user+password. If the database sink is configured it pulls from there, otherwise it just pulls the default creds from the config.

func InitSinks

func InitSinks(cfg *config.APIConfigSpec) error

InitSinks calls the correct initialization functions for each of the enabled sinks.

Types

This section is empty.

Directories

Path Synopsis
Package postgres contains all PostgreSQL databse connection logic and queries.
Package postgres contains all PostgreSQL databse connection logic and queries.
conn
Package conn handles the initialization and distribution of the database connection object.
Package conn handles the initialization and distribution of the database connection object.
graphs
Package graphs contains database functions for generating visualizations.
Package graphs contains database functions for generating visualizations.
users
Package users contains the DB functions and all SQL queries involving scoring users.
Package users contains the DB functions and all SQL queries involving scoring users.

Jump to

Keyboard shortcuts

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