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 ¶
- func Bootstrap(d Deps) *appaccess.Bootstrap
- func Console(edge *flaghttp.Server, defaultLocale string) (bool, error)
- func CreateInstanceAdmin(d Deps) *appaccess.CreateInstanceAdmin
- func Hasher() *password.Hasher
- func InstanceAdminExists(d Deps) *appaccess.InstanceAdminExists
- func PromoteMember(d Deps) *appaccess.PromoteMember
- func Unlock(d Deps) *appaccess.Unlock
- type Background
- type Deps
- type Listener
- type Options
- type Schedule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Console ¶
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 ¶
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 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
// IngestHold lets a test keep a batch's transaction open; nil in
// production.
IngestHold *pgevents.IngestHold
// RateLimits are the limits of the SDK API.
RateLimits config.RateLimits
// EventsRetention is how long raw events are kept.
EventsRetention time.Duration
// EventsLossWarning is how long before retention drops a row a sink that
// has not delivered it is at risk.
EventsLossWarning time.Duration
// EventsPartitionsAhead is how many days after today the raw event
// tables' partitions are created ahead of time.
EventsPartitionsAhead int
// AliasLinksLimit is the most alias links an environment keeps.
AliasLinksLimit int
// FirstExposuresLimit is the most first exposures an experiment keeps
// in an environment.
FirstExposuresLimit int
// SDKInventoryRetention is how long the SDK inventory keeps an SDK
// after it was last seen.
SDKInventoryRetention time.Duration
// WebhookTargets is what the operator allows a webhook subscription's
// target to be.
WebhookTargets governance.TargetPolicy
// WebhookTick is how often the replica fans the outbox out and sends the
// webhook deliveries that are due.
WebhookTick time.Duration
// SinkFault lets a test lose a sink stream's commit; nil in production.
SinkFault *pgsinks.Fault
// SinkTick is how often the replica looks for sink streams that are due
// and delivers their next batch.
SinkTick time.Duration
// SinkLagWarning is how old the oldest event a sink has not delivered
// may be before the sink is lagging.
SinkLagWarning time.Duration
// SinkRejectionAttempts is how many times a target must reject a batch
// for it to be set aside as a dead letter, and SinkStopAfterDeadLetters
// how many dead letters in a row on one stream stop the sink.
SinkRejectionAttempts, SinkStopAfterDeadLetters int
// WebhookSecretOverlap is how long a webhook subscription's rotated
// secret signs beside the new one.
WebhookSecretOverlap time.Duration
// Schedule is how change requests are scheduled and applied at their
// time.
Schedule Schedule
// AuditExportMaxEntries is the most entries one download of the audit
// log may hold.
AuditExportMaxEntries int
// AuditExportMaxConcurrent is how many downloads of the audit log the
// replica serves at once.
AuditExportMaxConcurrent int
// DigestSlot is when the weekly stale-flag digest is sent.
DigestSlot governance.DigestSlot
// DefaultLocale is the language of a mail whose recipient has not chosen
// one.
DefaultLocale string
// MailRootCAs are the roots an SMTP server's certificate is verified
// against; the system's when nil. The test kit sets it for the servers
// it starts.
MailRootCAs *x509.CertPool
management.Options
}
Options are how a replica serves, as its configuration sets them.