Liking cljdoc? Tell your friends :D

wagoe.platform.core.system-selection

Cut an Integrant config down to the modules one service runs.

Modules are already gated by :enabled?, and the router mounts only the routes it is handed, so a process can run a subset — there was just no way to say which subset (BOU-91). This is that, as a pure transformation: config in, smaller config out.

The whole difficulty is refs. Dropping :wagoe/tenant-service leaves :wagoe/http-handler pointing at a key that no longer exists, and Integrant refuses to build a config with a dangling ref — so the refs have to go with the keys, and they have to go first, or the closure that works out what is still needed follows them straight back to everything.

FC/IS: pure. Nothing here starts, stops or reads anything.

Cut an Integrant config down to the modules one service runs.

Modules are already gated by `:enabled?`, and the router mounts only the
routes it is handed, so a process *can* run a subset — there was just no way
to say which subset (BOU-91). This is that, as a pure transformation:
config in, smaller config out.

The whole difficulty is refs. Dropping `:wagoe/tenant-service` leaves
`:wagoe/http-handler` pointing at a key that no longer exists, and Integrant
refuses to build a config with a dangling ref — so the refs have to go with
the keys, and they have to go *first*, or the closure that works out what is
still needed follows them straight back to everything.

FC/IS: pure. Nothing here starts, stops or reads anything.
raw docstring

catalogue-problemclj

(catalogue-problem catalogue)

Why catalogue is malformed, or nil.

Shape only. It is tempting to also reject a catalogue naming keys the configuration does not build — that would catch a module renamed out from under it — but optional modules make it the normal case: workflow, search and payments are gated by :enabled?, so a config that has them off builds none of their keys and a correct catalogue still names them all.

The same mistake is caught at the moment it matters instead. Asking for a service this configuration builds nothing for is what selection-problem refuses, and it can tell the two apart because it knows which service was asked for.

Why `catalogue` is malformed, or nil.

Shape only. It is tempting to also reject a catalogue naming keys the
configuration does not build — that would catch a module renamed out from
under it — but optional modules make it the normal case: workflow, search
and payments are gated by `:enabled?`, so a config that has them off builds
none of their keys and a correct catalogue still names them all.

The same mistake is caught at the moment it matters instead. Asking for a
service this configuration builds nothing for is what `selection-problem`
refuses, and it can tell the two apart because it knows which service was
asked for.
sourceraw docstring

core-keysclj

(core-keys catalogue ig-config)

Keys no service owns — the ones every service needs anyway.

Derived rather than listed: the catalogue says what belongs to a module, and what is left over is the platform. A key nobody claimed is kept, so a catalogue that has fallen behind boots a service that is larger than necessary rather than one that is missing a component it needed.

Keys no service owns — the ones every service needs anyway.

Derived rather than listed: the catalogue says what belongs to a module, and
what is left over is the platform. A key nobody claimed is kept, so a
catalogue that has fallen behind boots a service that is larger than
necessary rather than one that is missing a component it needed.
sourceraw docstring

keys-forclj

(keys-for catalogue ig-config service-names)

The Integrant keys belonging to service-names, that this config builds.

The Integrant keys belonging to `service-names`, that this config builds.
sourceraw docstring

owned-keysclj

(owned-keys catalogue)

Every Integrant key the catalogue assigns to some service.

Every Integrant key the catalogue assigns to some service.
sourceraw docstring

selection-problemclj

(selection-problem catalogue ig-config service-names)

Why service-names cannot be run, or nil.

Fails on a name the catalogue does not know, and on one whose keys this configuration does not build. The second is the quieter mistake: asking for a module that is disabled in config would otherwise start a process that serves nothing and reports itself healthy.

Why `service-names` cannot be run, or nil.

Fails on a name the catalogue does not know, and on one whose keys this
configuration does not build. The second is the quieter mistake: asking for
a module that is disabled in config would otherwise start a process that
serves nothing and reports itself healthy.
sourceraw docstring

service-configclj

(service-config ig-config catalogue service-names)

ig-config reduced to what service-names need.

Order matters and is the whole trick. Refs to unselected modules are removed before the closure is taken: :wagoe/http-handler refers to every module's routes and services, so following its refs first drags the entire system back in — computing the closure on the untouched config keeps 28 of 33 keys and looks like it worked.

Returns the reduced config. Validate with selection-problem first; this assumes the names are known.

`ig-config` reduced to what `service-names` need.

Order matters and is the whole trick. Refs to unselected modules are removed
*before* the closure is taken: `:wagoe/http-handler` refers to every
module's routes and services, so following its refs first drags the entire
system back in — computing the closure on the untouched config keeps 28 of
33 keys and looks like it worked.

Returns the reduced config. Validate with `selection-problem` first; this
assumes the names are known.
sourceraw docstring

summaryclj

(summary ig-config service-config' service-names)

What a service boot dropped, for the log line that says so.

An operator reading started successfully needs to be able to tell a correctly slimmed service from one that quietly kept everything because the catalogue was stale.

What a service boot dropped, for the log line that says so.

An operator reading `started successfully` needs to be able to tell a
correctly slimmed service from one that quietly kept everything because the
catalogue was stale.
sourceraw docstring

without-refs-toclj

(without-refs-to value gone)

value with every ref to a key in gone removed.

A component that loses an input has to cope with its absence — which is the same thing it already does for a module disabled in config, since that produces exactly this shape. http-handler reads (:web routes) off a nil and mounts nothing, which is the behaviour the acceptance criterion asks for.

`value` with every ref to a key in `gone` removed.

A component that loses an input has to cope with its absence — which is the
same thing it already does for a module disabled in config, since that
produces exactly this shape. `http-handler` reads `(:web routes)` off a nil
and mounts nothing, which is the behaviour the acceptance criterion asks
for.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close