Liking cljdoc? Tell your friends :D

hive-compose.promote.capability

Pure capability resolver: which provider answers each need of every consumer in a stack, and which instances that makes.

Projects declare :project/provides {cap Provide} and :project/needs {cap Need} (hive-compose.schema). A consumer is a project id, a section id <project>/<target> (it needs what its project needs) or any other id carrying extra needs (a stack's own needs, a suite's).

Rules (decision 20261122141106-2d375c4f):

  • per capability, every consumer that shares (:share? true, the default) is resolved TOGETHER: exactly one provider must satisfy all of their ranges and pins, and they bind to its one shared instance <provider>/<cap>. Incompatible ranges are never split into two shared instances: they are an error naming every sharer;
  • :share? false resolves that consumer alone, to a private instance <provider>/<cap>@<consumer> nobody else uses;
  • errors are Results naming the capability and the consumers: :compose/invalid-range, :compose/invalid-version (a provider's), :compose/unknown-consumer, :compose/conflicting-pins, :compose/no-provider, :compose/incompatible-version, :compose/ambiguous-provider.

No IO and no host interop (portable Clojure, ready to become .cljc). Output is sorted and independent of input order.

Pure capability resolver: which provider answers each need of every
consumer in a stack, and which instances that makes.

Projects declare `:project/provides {cap Provide}` and `:project/needs
{cap Need}` (hive-compose.schema). A consumer is a project id, a section id
`<project>/<target>` (it needs what its project needs) or any other id
carrying extra needs (a stack's own needs, a suite's).

Rules (decision 20261122141106-2d375c4f):
- per capability, every consumer that shares (`:share?` true, the
  default) is resolved TOGETHER: exactly one provider must satisfy all of
  their ranges and pins, and they bind to its one shared instance
  `<provider>/<cap>`. Incompatible ranges are never split into two shared
  instances: they are an error naming every sharer;
- `:share? false` resolves that consumer alone, to a private instance
  `<provider>/<cap>@<consumer>` nobody else uses;
- errors are Results naming the capability and the consumers:
  :compose/invalid-range, :compose/invalid-version (a provider's),
  :compose/unknown-consumer, :compose/conflicting-pins,
  :compose/no-provider, :compose/incompatible-version,
  :compose/ambiguous-provider.

No IO and no host interop (portable Clojure, ready to become .cljc).
Output is sorted and independent of input order.
raw docstring

compare-versionsclj

(compare-versions a b)

Orders two parsed versions: by their numbers, missing parts reading as 0 ([3] = [3 0 0]), then by pre-release.

Orders two parsed versions: by their numbers, missing parts reading as 0
([3] = [3 0 0]), then by pre-release.
sourceraw docstring

compose-project-nameclj

(compose-project-name p)

The compose project name Project p runs under, as compose derives it.

The compose project name Project `p` runs under, as compose derives it.
sourceraw docstring

consumer-needsclj

(consumer-needs projects consumers extra)

Result<{consumer Needs}> for a stack: each of consumers (project or section ids) with its project's :project/needs, merged with extra ({consumer Needs}, e.g. a stack's or a suite's own needs). Merging is key by key: an extra {"kafka" {:share? false}} keeps the project's :version. A consumer with no project and no extra needs is :compose/unknown-consumer. projects is {project-id Project}.

Result<{consumer Needs}> for a stack: each of `consumers` (project or
section ids) with its project's `:project/needs`, merged with `extra`
({consumer Needs}, e.g. a stack's or a suite's own needs). Merging is
key by key: an extra `{"kafka" {:share? false}}` keeps the project's
:version. A consumer with no project and no extra needs is
:compose/unknown-consumer. `projects` is {project-id Project}.
sourceraw docstring

consumer-projectclj

(consumer-project projects c)

The project id whose :project/needs consumer c inherits: c itself when it names a project, the part before / for a section id, else nil.

The project id whose `:project/needs` consumer `c` inherits: `c` itself
when it names a project, the part before / for a section id, else nil.
sourceraw docstring

in-range?clj

(in-range? rng v)

True when parsed version v meets every constraint of parsed range rng.

True when parsed version `v` meets every constraint of parsed range `rng`.
sourceraw docstring

instance-idclj

(instance-id provider cap)
(instance-id provider cap consumer)

<provider>/<cap> for a shared instance, <provider>/<cap>@<consumer> for a private one.

`<provider>/<cap>` for a shared instance, `<provider>/<cap>@<consumer>`
for a private one.
sourceraw docstring

parse-rangeclj

(parse-range s)

Result<[[op version]..]>: a VersionRange as the constraints a version must all meet. nil and "*" accept anything. "3.7" is the 3.7 block (>=3.7.0 <3.8, its pre-releases such as 3.7.0-alpine included); "3.7.1" is that patch with its suffixed tags. "^3.7" keeps the leftmost non-zero part (<4; "^0.5" <0.6). "~3.7" keeps the minor (<3.8; "~3" <4). Space separated comparators ">=3.5 <4" are ANDed. Anything else, including an overflowing number, is :compose/invalid-range.

Result<[[op version]..]>: a VersionRange as the constraints a version must
all meet. nil and "*" accept anything. "3.7" is the 3.7 block (>=3.7.0
<3.8, its pre-releases such as 3.7.0-alpine included); "3.7.1" is that
patch with its suffixed tags. "^3.7" keeps the leftmost non-zero part
(<4; "^0.5" <0.6). "~3.7" keeps the minor (<3.8; "~3" <4). Space
separated comparators ">=3.5 <4" are ANDed. Anything else, including an
overflowing number, is :compose/invalid-range.
sourceraw docstring

parse-versionclj

(parse-version s)

Result<{:nums [major minor? patch?] :pre pre-release-or-nil}> for a Version string. A - suffix is a pre-release ("3.7.1-alpine" -> :pre "alpine"), ordered below the bare release as semver orders them; a + build suffix is ignored.

Result<{:nums [major minor? patch?] :pre pre-release-or-nil}> for a Version
string. A `-` suffix is a pre-release ("3.7.1-alpine" -> :pre "alpine"),
ordered below the bare release as semver orders them; a `+` build suffix
is ignored.
sourceraw docstring

providers-ofclj

(providers-of projects cap)

Sorted [project-id Provide] of every project providing cap.

Sorted [project-id Provide] of every project providing `cap`.
sourceraw docstring

resolve-needsclj

(resolve-needs projects needs)
(resolve-needs projects needs {:keys [run]})

Result<Resolution> for needs ({consumer Needs}, see consumer-needs) against projects ({project-id Project}). opts: :run a RunId; with it every instance carries :instance/compose-project (the provider's for a shared one, schema/private-project for a private one), which schema/Instance requires of a private instance.

Ok: {:resolution/instances (sorted {id Instance}) :resolution/bindings (sorted {consumer (sorted {cap instance-id})})}. Err: the first error, sorted, carrying every error under :errors; each names :capability, :consumers, :ranges and a :message.

Result<Resolution> for `needs` ({consumer Needs}, see `consumer-needs`)
against `projects` ({project-id Project}). `opts`: `:run` a RunId; with it
every instance carries `:instance/compose-project` (the provider's for a
shared one, `schema/private-project` for a private one), which
schema/Instance requires of a private instance.

Ok: {:resolution/instances (sorted {id Instance})
     :resolution/bindings (sorted {consumer (sorted {cap instance-id})})}.
Err: the first error, sorted, carrying every error under :errors; each
names :capability, :consumers, :ranges and a :message.
sourceraw docstring

resolve-stackclj

(resolve-stack projects stack)
(resolve-stack projects stack {:keys [extra] :as opts})

Result<Resolution> for Stack stack over projects: its consumers with their projects' needs, plus :stack/needs under stack-consumer, plus (:extra opts) ({consumer Needs}, e.g. suites). (:run opts) as in resolve-needs.

Result<Resolution> for Stack `stack` over `projects`: its consumers with
their projects' needs, plus `:stack/needs` under `stack-consumer`, plus
`(:extra opts)` ({consumer Needs}, e.g. suites). `(:run opts)` as in
`resolve-needs`.
sourceraw docstring

stack-consumerclj

(stack-consumer stack)

The consumer id a stack's own :stack/needs are bound to: stack:<id>.

The consumer id a stack's own `:stack/needs` are bound to: `stack:<id>`.
sourceraw docstring

version-satisfies?clj

(version-satisfies? rng-str version)

True when Version string version is in VersionRange string rng-str. A provider with no version satisfies only "*" (or no range): what it runs is unknown. Invalid input satisfies nothing.

True when Version string `version` is in VersionRange string `rng-str`. A
provider with no version satisfies only "*" (or no range): what it runs
is unknown. Invalid input satisfies nothing.
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