Adds logic to archive the contents of log graphs on reset.
Adds logic to archive the contents of log graphs on reset.
A channel containing a series of archive-state
s reflecting the fact that the old log has been archived and a new one has been declared.
Typically handlers of this channel will call set-continuing-from!
on each
archive-state
to link the new log-graph back to the archive of the previous graph.
Where
set-continuing-from!
:= fn [archive-state] -> ? with side-effect of setting
(@glog/log-graph :glog/LogGraph :glog/continuingFrom) to volume
archive-state
:= {::volume ..., ...}volume
is the file holding an edn representation of the previous
incarnation of @glog/log-graph.A channel containing a series of `archive-state`s reflecting the fact that the old log has been archived and a new one has been declared. Typically handlers of this channel will call `set-continuing-from!` on each `archive-state` to link the new log-graph back to the archive of the previous graph. Where - `set-continuing-from!` := fn [archive-state] -> ? with side-effect of setting (@glog/log-graph :glog/LogGraph :glog/continuingFrom) to `volume` - `archive-state` := {::volume ..., ...} - `volume` is the file holding an edn representation of the previous incarnation of @glog/log-graph.
A channel which will call its handler (set in def-listener
) on each reset-state
Where
handler
:= fn [reset-state] -> ? with side-effect of archving old-graph
reset-state
:= {:old-graph ..., :new-graph ..., ...}
old-graph
is the old log-graph being reset to new-graph
A channel which will call its handler (set in `def-listener`) on each `reset-state` Where `handler` := fn [reset-state] -> ? with side-effect of archving `old-graph` `reset-state` := {:old-graph ..., :new-graph ..., ...} `old-graph` is the old log-graph being reset to `new-graph`
(archive-path g)
Returns a canonical name for an archive file for a log, caluclated per archive-path-fn
derived from g
Where
g
is a log-graph, Typically glog:LogGraph
archive-path-fn
:= [g] -> archive-path
. Or default-archive-path
VOCABULARY:
:glog/archivePathFn
<fn kw>:glog/timestamp
<timestamp>:glog/archiveDirectory
<directory URL>:igraph/compiledAs
<fn [g] -> archive-path>Returns a canonical name for an archive file for a log, caluclated per `archive-path-fn` derived from `g` Where - `g` is a log-graph, Typically `glog:LogGraph` - `archive-path-fn` := [g] -> `archive-path`. Or `default-archive-path` VOCABULARY: - <log-graph> `:glog/archivePathFn` <fn kw> - <log-graph> `:glog/timestamp` <timestamp> - <log-graph> `:glog/archiveDirectory` <directory URL> - <fn kw> `:igraph/compiledAs` <fn [g] -> archive-path>
(archive-to-file reset-state)
Side-effects: writes contents
inferred from reset-state
to archive-file
and posts archive-state
to >>log-is-archived>>
.
Where
contents
is old-graph
minus new-graph
, and anything that would choke a
reader, rendered in EDN.reset-state
:= {::topic ::log-reset
::old-graph
...
::new-graph
...
}archive-state
:= {::topic ::archive-state
::volume archive-file
,
...}, merged with reset-state
.old-graph
is the previous contents of a log-graphnew-graph
is the newly reset log-grapharchive-file
is the path to a the contents
written to disk.Side-effects: writes `contents` inferred from `reset-state` to `archive-file` and posts `archive-state` to `>>log-is-archived>>`. Where - `contents` is `old-graph` minus `new-graph`, and anything that would choke a reader, rendered in EDN. - `reset-state` := {::topic ::log-reset ::`old-graph` ... ::`new-graph` ... } - `archive-state` := {::topic ::archive-state ::volume `archive-file`, ...}, merged with `reset-state`. - `old-graph` is the previous contents of a log-graph - `new-graph` is the newly reset log-graph - `archive-file` is the path to a the `contents` written to disk.
(check-archiving!)
(check-archiving! ms)
(check-archiving! gatom ms)
Side-effect: sets the :glog/continuingFrom relation in gatom
Where
gatom
is an atom containing an IGraph, (default log-graph
),
it must be configured so as to enable archiving.ms
is a timeout in millisecondsarchive-state
:= {:glog/continuingFrom url
, ...}url
is typically the URL of the contents of the previous gatom
,
before the most recent call to log-reset!
.VOCABULARY:
:glog/LogGraph
- identifies the log graph itself in @log-graph:glog/FreshArchive
- names type for LogGraph with 0 iterations<log-graph>
:glog/iteration` <# of times graph has been reset><log-graph>
:glog/continuingFrom` <url of previous archived log iteration>Side-effect: sets the :glog/continuingFrom relation in `gatom` Where - `gatom` is an atom containing an IGraph, (default `log-graph`), it must be configured so as to enable archiving. - `ms` is a timeout in milliseconds - `archive-state` := {:glog/continuingFrom `url`, ...} - `url` is typically the URL of the contents of the previous `gatom`, before the most recent call to `log-reset!`. VOCABULARY: - `:glog/LogGraph` - identifies the log graph itself in @log-graph - `:glog/FreshArchive` - names type for LogGraph with 0 iterations - `<log-graph> `:glog/iteration` <# of times graph has been reset> - `<log-graph> `:glog/continuingFrom` <url of previous archived log iteration>
The timeout in ms for the check-archiving!
function. Default is 1000
The timeout in ms for the `check-archiving!` function. Default is 1000
(def-listener channel handler)
Expands to a go-loop which Binds to a channel
a handler
Where
channel
is an async porthandler
:= [article] -> ?, typically with the side-effect of archiving article
article
is an item read from channel
asynchronously. Typically in a format
specific to channel
.Expands to a go-loop which Binds to a `channel` a `handler` Where - `channel` is an async port - `handler` := [article] -> ?, typically with the side-effect of archiving `article` - `article` is an item read from `channel` asynchronously. Typically in a format specific to `channel`.
(default-archive-path g)
Returns rendering of {{directory}}/{{start}}-{{stop}}.edn
Where
directory
is (g :glog/LogGraph :glog/archiveDirectory) or /tmpstart
is the timestamp of the 0th entrystop
is the timestamp of the nth entryVOCABULARY
:glog/archiveDirectory
directory
(optional; default /tmp):glog/timestamp
<epoch ms>Returns rendering of `{{directory}}/{{start}}-{{stop}}.edn` Where - `directory` is (g :glog/LogGraph :glog/archiveDirectory) or /tmp - `start` is the timestamp of the 0th entry - `stop` is the timestamp of the nth entry VOCABULARY - <graph-log> `:glog/archiveDirectory` `directory` (optional; default /tmp) - <log entry> `:glog/timestamp` <epoch ms>
(log-reset!)
(log-reset! new-graph)
Side-effect: resets @log-graph to new-graph
Side-effect: if (initial-graph:glog/ArchivePathFn igraph/compiledAs <path-fn>),
the previous contents of the graph will be spit'd to <output-path>
Where
VOCABULARY
:glog/LogGraph
- identifies the log graph itself in @log-graph:glog/iteration
<# of times graph has been reset>:glog/archivePathFn
<fn kw>:igraph/compiledAs
<fn [g] -> archive path>Side-effect: resets @log-graph to `new-graph` Side-effect: if (initial-graph:glog/ArchivePathFn igraph/compiledAs <path-fn>), the previous contents of the graph will be spit'd to <output-path> Where - <initial-graph> is an IGraph, informed by ont-app.graph-log.core/ontology - <path-fn> := fn [g] -> <output-path> - <output-path> is a valid path specification , possibly starting with file:// VOCABULARY - `:glog/LogGraph` - identifies the log graph itself in @log-graph - <log-graph> `:glog/iteration` <# of times graph has been reset> - <log-graph> `:glog/archivePathFn` <fn kw> - <fn kw> `:igraph/compiledAs` <fn [g] -> archive path>
(save-to-archive! archive-path g)
Side-effect: Writes contents of g
to archive-path
, after removing stuff that would choke a reader.
Returns archive-path
for g
Where:
g
is a graph derived from a log-graph
archive-path
is a path to which the contents of g
are written, generated
by (archive-path-fn
g
)
archive-path-fn
is a compiled function asserted with :glog/archivePathFn
,
or the default function archive-path
.
VOCABULARY
:glog/archivePathFn
<fn kw>:igraph/compiledA
s <fn>Side-effect: Writes contents of `g` to `archive-path`, after removing stuff that would choke a reader. Returns `archive-path` for `g` Where: - `g` is a graph derived from a log-graph - `archive-path` is a path to which the contents of `g` are written, generated by (`archive-path-fn` `g`) - `archive-path-fn` is a compiled function asserted with `:glog/archivePathFn`, or the default function `archive-path`. VOCABULARY - <log-graph> `:glog/archivePathFn` <fn kw> - <fn kw> `:igraph/compiledA`s <fn>
(set-continuing-from! archive-state)
Side-effect: establishes :glog/coninuingFrom in value per archive-state
in gatom
Where
archive-state
:= {::volume url
, ...}gatom
(optional) an atom containing an IGraph. Default is log-graphurl
is the URL of a location where the previous contents of @log-graph
have been archived.VOCABULARY:
:glog/LogGraph
:glog/continuingFrom
url
Side-effect: establishes :glog/coninuingFrom in value per `archive-state` in `gatom` Where - `archive-state` := {::volume `url`, ...} - `gatom` (optional) an atom containing an IGraph. Default is log-graph - `url` is the URL of a location where the previous contents of @log-graph have been archived. - Note: may throw error of type ::UnexpectedArchivingResult. VOCABULARY: - `:glog/LogGraph` - <log-graph> `:glog/continuingFrom` `url`
Set to true
when you want to tap> each article when it comes off a listener channel.
Set to `true` when you want to tap> each article when it comes off a listener channel.
(wait-for the-test ms)
Returns: non-falsey result
of test
, or ::timeout after ms
milliseconds.
Where
result
is a truthy response from test
the-test
:= fn [] -> truthy valuems
is max time to wait for test
to be truthyReturns: non-falsey `result` of `test`, or ::timeout after `ms` milliseconds. Where - `result` is a truthy response from `test` - `the-test` := fn [] -> truthy value - `ms` is max time to wait for `test` to be truthy
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close