diff --git a/index.html b/index.html index c9901d2..fa51f97 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,3 @@ -Integrant 0.7.0

Integrant 0.7.0

Released under the MIT License

Micro-framework for data-driven architecture.

Installation

To install, add the following dependency to your project or build file:

[integrant "0.7.0"]

Namespaces

integrant.core

\ No newline at end of file +Integrant 0.9.0

Integrant 0.9.0

Released under the MIT License

Micro-framework for data-driven architecture.

Installation

To install, add the following dependency to your project or build file:

[integrant "0.9.0"]

Namespaces

integrant.core

\ No newline at end of file diff --git a/integrant.core.html b/integrant.core.html index aba4915..73ec398 100644 --- a/integrant.core.html +++ b/integrant.core.html @@ -1,60 +1,84 @@ -integrant.core documentation

integrant.core

build

(build config keys f)(build config keys f assertf)
Apply a function f to each key value pair in a configuration map. Keys are
+integrant.core documentation

integrant.core

assert-key

multimethod

(assert-key key value)
Check that the value of a key is correct immediately before the key is
+initiated. If the value is incorrect, an appropriate exception should
+be thrown.

build

(build config keys f)(build config keys f assertf)(build config keys f assertf resolvef)
Apply a function f to each key value pair in a configuration map. Keys are
 traversed in dependency order, and any references in the value expanded. The
 function should take two arguments, a key and value, and return a new value.
 An optional fourth argument, assertf, may be supplied to provide an assertion
-check on the system, key and expanded value.

composite-keyword

(composite-keyword kws)
Return a unique keyword that is derived from an ordered collection of
-keywords. The function will return the same keyword for the same collection.

dependency-graph

(dependency-graph config)(dependency-graph config {:keys [include-refsets?], :or {include-refsets? true}})
Return a dependency graph of all the refs and refsets in a config. Resolves
+check on the system, key and expanded value.

composite-keyword

(composite-keyword kws)
Return a unique keyword that is derived from an ordered collection of
+keywords. The function will return the same keyword for the same collection.

dependency-graph

(dependency-graph config)(dependency-graph config {:keys [include-refsets?], :or {include-refsets? true}})
Return a dependency graph of all the refs and refsets in a config. Resolves
 derived dependencies. Takes the following options:
 
 `:include-refsets?`
-: whether to include refsets in the dependency graph (defauls to true)

derived-from?

(derived-from? key candidate)
Return true if a key is derived from candidate keyword or vector of
-keywords.

expand

(expand config)
Replace all refs with the values they correspond to.
-

find-derived

(find-derived m k)
Return a seq of all entries in a map, m, where the key is derived from the
+: whether to include refsets in the dependency graph (defaults to true)

derived-from?

(derived-from? key candidate)
Return true if a key is derived from candidate keyword or vector of
+keywords.

expand

(expand config)(expand config keys)
Expand modules in the config map prior to initiation. The expand-key method
+is applied to each entry in the map, and the results deep-merged together to
+produce a new configuration.
+
+If there are conflicting keys with different values, an exception will be
+raised. Conflicts can be resolved by tagging one value with the :override
+metadata key.

expand-key

multimethod

(expand-key key value)
Expand a config value into a map that is then merged back into the config.
+Defaults to returning a map `{key value}`. See: [[expand]].

find-derived

(find-derived m k)
Return a seq of all entries in a map, m, where the key is derived from the
 a candidate key, k. If there are no matching keys, nil is returned. The
-candidate key may be a keyword, or vector of keywords.

find-derived-1

(find-derived-1 m k)
Return the map entry in a map, m, where the key is derived from the keyword,
+candidate key may be a keyword, or vector of keywords.

find-derived-1

(find-derived-1 m k)
Return the map entry in a map, m, where the key is derived from the keyword,
 k. If there are no matching keys, nil is returned. If there is more than one
-matching key, an ambiguous key exception is raised.

fold

(fold system f val)
Reduce all the key value pairs in system map in dependency order, starting
+matching key, an ambiguous key exception is raised.

fold

(fold system f val)
Reduce all the key value pairs in system map in dependency order, starting
 from an initial value. The function should take three arguments: the
-accumulator, the current key and the current value.

halt!

(halt! system)(halt! system keys)
Halt a system map by applying halt-key! in reverse dependency order.
-

halt-key!

multimethod

(halt-key! key value)
Halt a running or suspended implementation associated with a key. This is
+accumulator, the current key and the current value.

halt!

(halt! system)(halt! system keys)
Halt a system map by applying halt-key! in reverse dependency order.
+

halt-key!

multimethod

(halt-key! key value)
Halt a running or suspended implementation associated with a key. This is
 often used for stopping processes or cleaning up resources. For example, a
 database connection might be closed. This multimethod must be idempotent.
-The return value of this multimethod is discarded.

init

(init config)(init config keys)
Turn a config map into an system map. Keys are traversed in dependency
+The return value of this multimethod is discarded.

init

(init config)(init config keys)
Turn a config map into an system map. Keys are traversed in dependency
 order, initiated via the init-key multimethod, then the refs associated with
-the key are expanded.

init-key

multimethod

(init-key key value)
Turn a config value associated with a key into a concrete implementation.
-For example, a database URL might be turned into a database connection.

key-comparator

(key-comparator graph)
Create a key comparator from the dependency graph of a configuration map.
+the key are resolved.

init-key

multimethod

(init-key key value)
Turn a config value associated with a key into a concrete implementation.
+For example, a database URL might be turned into a database connection.

key-comparator

(key-comparator graph)
Create a key comparator from the dependency graph of a configuration map.
 The comparator is deterministic; it will always result in the same key
-order.

load-namespaces

(load-namespaces config)(load-namespaces config keys)
Attempt to load the namespaces referenced by the keys in a configuration.
+order.

load-hierarchy

(load-hierarchy)(load-hierarchy path)
Search the base classpath for all resources that share the same
+path (by default `integrant/hierarchy.edn`), and use their contents
+to extend the global `derive` hierarchy. This allows a hierarchy to be
+constructed without needing to load every namespace.
+
+The hierarchy resources should be edn files that map child keywords
+to vectors of parents. For example:
+
+    {:example/child [:example/father :example/mother]}
+
+This is equivalent:
+
+    (derive :example/child :example/father)
+    (derive :example/child :example/mother)

load-namespaces

(load-namespaces config)(load-namespaces config keys)
Attempt to load the namespaces referenced by the keys in a configuration.
 If a key is namespaced, both the namespace and the namespace concatenated
-with the name will be tried. For example, if a key is :foo.bar/baz, then the
-function will attempt to load the namespaces foo.bar and foo.bar.baz. Upon
-completion, a list of all loaded namespaces will be returned.

pre-init-spec

multimethod

Return a spec for the supplied key that is used to check the associated
-value before the key is initiated.

prep

(prep config)(prep config keys)
Prepare a config map for initiation. The prep-key method is applied to each
+with the name will be tried. For example, if a key is :foo.bar/baz, then
+the function will attempt to load the namespaces foo.bar and foo.bar.baz.
+Upon completion, a list of all loaded namespaces will be returned.

normalize-key

(normalize-key key)
Given a valid Integrant key, return a keyword that uniquely identifies it.
+

prep

deprecated in 0.9.0

(prep config)(prep config keys)
Prepare a config map for initiation. The prep-key method is applied to each
 entry in the map, and the values replaced with the return value. This is used
-for adding default values and references to the configuration.

prep-key

multimethod

(prep-key key value)
Prepare the configuration associated with a key for initiation. This is
+for adding default values and references to the configuration.

prep-key

multimethod

deprecated in 0.9.0

(prep-key key value)
Prepare the configuration associated with a key for initiation. This is
 generally used to add in default values and references. By default the
-method returns the value unaltered.

read-string

(read-string s)(read-string opts s)
Read a config from a string of edn. Refs may be denotied by tagging keywords
-with #ig/ref.

ref

(ref key)
Create a reference to a top-level key in a config map.
-

ref?

(ref? x)
Return true if its argument is a ref.
-

RefLike

protocol

members

ref-key

(ref-key r)
Return the key of the reference.
-

reflike?

(reflike? x)
Return true if its argument is a ref or a refset.
-

refset

(refset key)
Create a set of references to all matching top-level keys in a config map.
-

refset?

(refset? x)
Return true if its argument is a refset.
-

resume

(resume config system)(resume config system keys)
Turn a config map into a system map, reusing resources from an existing
+method returns the value unaltered.

read-string

(read-string s)(read-string opts s)
Read a config from a string of edn. Refs may be denotied by tagging keywords
+with #ig/ref.

ref

(ref key)
Create a reference to a top-level key in a config map.
+

ref?

(ref? x)
Return true if its argument is a ref.
+

RefLike

protocol

members

ref-key

(ref-key r)
Return the key of the reference.
+

ref-resolve

(ref-resolve r config resolvef)
Return the resolved value.
+

reflike?

(reflike? x)
Return true if its argument is a ref or a refset.
+

refset

(refset key)
Create a set of references to all matching top-level keys in a config map.
+

refset?

(refset? x)
Return true if its argument is a refset.
+

resolve-key

multimethod

(resolve-key key value)
Return a value to substitute for a reference prior to initiation. By default
+the value of the key is returned unaltered. This can be used to hide
+information that is only necessary to halt or suspend the key.

resume

(resume config system)(resume config system keys)
Turn a config map into a system map, reusing resources from an existing
 system when it's possible to do so. Keys are traversed in dependency order,
 resumed with the resume-key multimethod, then the refs associated with the
-key are expanded.

resume-key

multimethod

(resume-key key value old-value old-impl)
Turn a config value associated with a key into a concrete implementation,
+key are resolved.

resume-key

multimethod

(resume-key key value old-value old-impl)
Turn a config value associated with a key into a concrete implementation,
 but reuse resources (e.g. connections, running threads, etc) from an existing
 implementation. By default this multimethod calls init-key and ignores the
-additional argument.

reverse-run!

(reverse-run! system keys f)
Apply a side-effectful function f to each key value pair in a system map.
+additional argument.

reverse-run!

(reverse-run! system keys f)
Apply a side-effectful function f to each key value pair in a system map.
 Keys are traversed in reverse dependency order. The function should take two
-arguments, a key and value.

run!

(run! system keys f)
Apply a side-effectful function f to each key value pair in a system map.
+arguments, a key and value.

run!

(run! system keys f)
Apply a side-effectful function f to each key value pair in a system map.
 Keys are traversed in dependency order. The function should take two
-arguments, a key and value.

suspend!

(suspend! system)(suspend! system keys)
Suspend a system map by applying suspend-key! in reverse dependency order.
-

suspend-key!

multimethod

(suspend-key! key value)
Suspend a running implementation associated with a key, so that it may be
+arguments, a key and value.

suspend!

(suspend! system)(suspend! system keys)
Suspend a system map by applying suspend-key! in reverse dependency order.
+

suspend-key!

multimethod

(suspend-key! key value)
Suspend a running implementation associated with a key, so that it may be
 eventually passed to resume-key. By default this multimethod calls halt-key!,
 but it may be customized to do things like keep a server running, but buffer
-incoming requests until the server is resumed.

valid-config-key?

(valid-config-key? key)
Returns true if the key is a keyword or valid composite key.
-
\ No newline at end of file +incoming requests until the server is resumed.

valid-config-key?

(valid-config-key? key)
Return true if the key is a keyword or valid composite key.
+
\ No newline at end of file