Liking cljdoc? Tell your friends :D

salutem.core.maintenance

Provides an asynchronous maintenance pipeline for maintaining up-to-date results for the checks in a registry.

Provides an asynchronous maintenance pipeline for maintaining up-to-date
results for the checks in a registry.
raw docstring

evaluation-state-storeclj

(evaluation-state-store)
(evaluation-state-store logger)

evaluatorclj

(evaluator dependencies evaluation-channel)
(evaluator dependencies state-store evaluation-channel)
(evaluator dependencies evaluation-channel result-channel skip-channel)
(evaluator dependencies
           state-store
           evaluation-channel
           result-channel
           skip-channel)

maintainclj

(maintain registry-store)
(maintain registry-store
          {:keys [context interval notification-callback-fns trigger-channel
                  evaluation-channel result-channel skip-channel
                  updater-result-channel notifier-result-channel]
           :or {interval (t/new-duration 200 :millis)
                trigger-channel (async/chan (async/sliding-buffer 1))
                evaluation-channel (async/chan 10)
                result-channel (async/chan 10)
                skip-channel (async/chan (async/sliding-buffer 10))
                updater-result-channel (async/chan 10)
                context {}
                notification-callback-fns []
                notifier-result-channel (async/chan 10)}})

Constructs and starts a maintenance pipeline to maintain up-to-date results for the checks in the registry in the provided registry store atom.

The maintenance pipeline consists of a number of independent processes:

  • a maintainer which triggers an attempt to refresh the results periodically,
  • a refresher which requests evaluation of each outdated check on each refresh attempt,
  • an evaluator which evaluates outdated checks to obtain a fresh result,
  • an updater which updates the registry store atom with fresh check results,
  • a notifier which calls callback functions when fresh check results are available.

The maintenance pipeline can be configured via an optional map which can contain the following options:

  • :context: a map containing arbitrary context required by checks in order to run and passed to the check functions as the first argument; defaults to an empty map
  • :interval: a [[duration]] describing the wait interval between attempts to refresh the results in the registry; defaults to 200 milliseconds
  • :notification-callback-fns: a sequence of arity-2 functions, with the first argument being a check and the second argument being a result, which are called whenever a new result is available for a check; empty by default
  • :trigger-channel: the channel on which trigger messages are sent, to indicate that a refresh of the registry should be attempted, defaults to a channel with a sliding buffer of length 1, i.e., in the case of a long running attempt, all but the latest trigger message will be dropped from the channel
  • :evaluation-channel: the channel on which messages requesting evaluation of checks are sent, defaults to a channel with a buffer of size 10
  • :result-channel: the channel on which results are placed after evaluation, defaults to a channel with a buffer of size 10
  • :updater-result-channel: a tap of the result-channel which sends result messages on to the updater, defaults to a channel with a buffer of size 10
  • :notifier-result-channel: a tap of the result-channel which sends result messages on to the notifier, defaults to a channel with a buffer of size 10

If the context map contains a :logger key with a cartus.core/Logger value, the maintenance pipeline will emit a number of log events throughout operation.

Returns the maintenance pipeline which can be passed to shutdown in order to stop operation.

Constructs and starts a maintenance pipeline to maintain up-to-date results
for the checks in the registry in the provided registry store atom.

The maintenance pipeline consists of a number of independent processes:

  - a _maintainer_ which triggers an attempt to refresh the results
    periodically,
  - a _refresher_ which requests evaluation of each outdated check on each
    refresh attempt,
  - an _evaluator_ which evaluates outdated checks to obtain a fresh result,
  - an _updater_ which updates the registry store atom with fresh check
    results,
  - a _notifier_ which calls callback functions when fresh check results are
    available.

The maintenance pipeline can be configured via an optional map which
can contain the following options:

  - `:context`: a map containing arbitrary context required by checks in
    order to run and passed to the check functions as the first
    argument; defaults to an empty map
  - `:interval`: a [[duration]] describing the wait interval between
    attempts to refresh the results in the registry; defaults to 200
    milliseconds
  - `:notification-callback-fns`: a sequence of arity-2 functions, with the
    first argument being a check and the second argument being a result,
    which are called whenever a new result is available for a check; empty by
    default
  - `:trigger-channel`: the channel on which trigger messages are sent, to
    indicate that a refresh of the registry should be attempted, defaults
    to a channel with a sliding buffer of length 1, i.e., in the case of a
    long running attempt, all but the latest trigger message will be dropped
    from the channel
  - `:evaluation-channel`: the channel on which messages requesting
    evaluation of checks are sent, defaults to a channel with a buffer of
    size 10
  - `:result-channel`: the channel on which results are placed after
    evaluation, defaults to a channel with a buffer of size 10
  - `:updater-result-channel`: a tap of the `result-channel` which sends
    result messages on to the updater, defaults to a channel with a buffer
    of size 10
  - `:notifier-result-channel`: a tap of the `result-channel` which sends
    result messages on to the notifier, defaults to a channel with a buffer
    of size 10

If the context map contains a `:logger` key with a
[`cartus.core/Logger`](https://logicblocks.github.io/cartus/cartus.core.html#var-Logger)
value, the maintenance pipeline will emit a number of log events
throughout operation.

Returns the maintenance pipeline which can be passed to [[shutdown]] in
order to stop operation.
raw docstring

maintainerclj

(maintainer dependencies registry-store context interval trigger-channel)
(maintainer dependencies
            registry-store
            context
            interval
            trigger-channel
            shutdown-channel)

notifierclj

(notifier dependencies callbacks result-channel)

refresherclj

(refresher dependencies trigger-channel)
(refresher dependencies trigger-channel evaluation-channel)

shutdownclj

(shutdown maintenance-pipeline)

Shuts down the maintenance pipeline preventing further updates to the registry.

Shuts down the maintenance pipeline preventing further updates to the
registry.
raw docstring

updaterclj

(updater dependencies registry-store result-channel)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close