compose

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package compose assembles a replica: it builds the application's handlers on their PostgreSQL and other outbound adapters and mounts the APIs on the edge. The serve command and the test kit's in-process server both use it, so tests exercise the replica that runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(d Deps) *appaccess.Bootstrap

Bootstrap returns the use case creating the first instance admin.

func Console

func Console(edge *flaghttp.Server, defaultLocale string) (bool, error)

Console mounts the embedded console on edge, its entry document naming defaultLocale, and reports whether the binary holds a build of the console rather than the placeholder page.

func CreateInstanceAdmin

func CreateInstanceAdmin(d Deps) *appaccess.CreateInstanceAdmin

CreateInstanceAdmin returns the use case adding an instance admin from the command line.

func Hasher

func Hasher() *password.Hasher

Hasher returns the password hasher of a command line, which hashes one password and needs no bound.

func InstanceAdminExists

func InstanceAdminExists(d Deps) *appaccess.InstanceAdminExists

InstanceAdminExists returns the query telling whether the instance has an instance admin.

func PromoteMember

func PromoteMember(d Deps) *appaccess.PromoteMember

PromoteMember returns the use case making a member an instance admin from the command line.

Types

type Background

type Background struct {
	// Workers are registered with the replica's runner.
	Workers []worker.Worker
	// Listeners are started on the replica's notification listeners.
	Listeners []Listener
	// Close ends the work the replica's use cases started on their own, such
	// as the ruleset loads in flight; whoever runs the replica calls it once
	// the requests are done.
	Close func()
}

Background is the work a replica does besides answering requests, which whoever runs the replica starts.

func Management

func Management(edge *flaghttp.Server, d Deps, reg prometheus.Registerer, o Options) Background

Management mounts the management API and the SDK API on edge, their metrics on reg, and returns the background work their use cases need.

type Deps

type Deps struct {
	Pool  *pgxpool.Pool
	Clock clock.Clock
	IDs   *id.Source
}

Deps are what a replica's use cases run on.

func NewDeps

func NewDeps(pool *pgxpool.Pool, c clock.Clock) Deps

NewDeps returns the dependencies of a replica on pool, timed by c, minting identifiers from c.

type Listener

type Listener struct {
	Channel string
	Handler pglisten.Handler
}

Listener is a handler of the notifications of one channel.

type Options

type Options struct {
	// Keyring holds the instance's secret key, which session cookies are
	// signed under.
	Keyring *secret.Keyring
	// PasswordHashConcurrency bounds the password hashes and verifications
	// the replica runs at once.
	PasswordHashConcurrency int
	// RulesetLoadFault lets a test stall the replica's ruleset
	// materializations; nil in production.
	RulesetLoadFault *pgdelivery.RulesetLoadFault
	// RateLimits are the limits of the SDK API.
	RateLimits config.RateLimits
	// EventsRetention is how long raw events are kept.
	EventsRetention time.Duration
	// EventsPartitionsAhead is how many days after today the raw event
	// tables' partitions are created ahead of time.
	EventsPartitionsAhead int
	// SDKInventoryRetention is how long the SDK inventory keeps an SDK
	// after it was last seen.
	SDKInventoryRetention time.Duration
	management.Options
}

Options are how a replica serves, as its configuration sets them.

Jump to

Keyboard shortcuts

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