(add-events! src events)
Adds all the given events to src
.
Adds all the given events to `src`.
(event time value)
Creates an event that happened at the given time (a java.time.Instant
) and is described by the given arbitrary value.
Creates an event that happened at the given time (a `java.time.Instant`) and is described by the given arbitrary value.
(event-time event)
Returns the time of the given event
.
Returns the time of the given [[event]].
(event-value event)
Returns the value of the given event
.
Returns the value of the given [[event]].
(event? v)
Returns is the given value is an event
.
Returns is the given value is an [[event]].
(filtered-event-source src pred)
Returns a new event source, that contains only the events from src
that match pred
. The predicate must also hold for events added
it.
Returns a new event source, that contains only the events from `src` that match `pred`. The predicate must also hold for events added it.
(juxt-reducers reducers)
Combines multiple reducing functions into a single one, that reduces events to a vector of their results.
Combines multiple reducing functions into a single one, that reduces events to a vector of their results.
(new-memory-event-source)
Returns a new event source that holds events in an atom.
Returns a new event source that holds events in an atom.
(reduce-events src f)
(reduce-events src f init)
Retrieve all events from src
and reduce them into a different
form. Note that if no init
value is given, then f
should return
an 'empty' value when called with no arguments.
Retrieve all events from `src` and reduce them into a different form. Note that if no `init` value is given, then `f` should return an 'empty' value when called with no arguments.
(reduce-events-memoized src f)
(reduce-events-memoized src f init)
(reduce-events-memoized src f init init-time)
Returns a thunk that will retrieve all events from src
when called
and reduce them into a different form. When the thunk is called
again, it will reduce once events with a younger timestamp than the
last event seen before. If you pass init-time
the first call will
reduce only over the events younger than that time, which enables
you to start with a snapshotted value.
Note that in order to use this, you must make sure that you only add events to the events source that have a younger timestamp than all that were already contained in it before.
Note that if no init
value is given, then f
should return an
'empty' value when called with no arguments.
The returned function is thread-safe, but if it is called in multiple threads in parallel, some events might be processed in more than one thread.
Returns a thunk that will retrieve all events from `src` when called and reduce them into a different form. When the thunk is called again, it will reduce once events with a younger timestamp than the last event seen before. If you pass `init-time` the first call will reduce only over the events younger than that time, which enables you to start with a snapshotted value. Note that in order to use this, you must make sure that you only add events to the events source that have a younger timestamp than all that were already contained in it before. Note that if no `init` value is given, then `f` should return an 'empty' value when called with no arguments. The returned function is thread-safe, but if it is called in multiple threads in parallel, some events might be processed in more than one thread.
(reduce-events-since src since f)
(reduce-events-since src since f init)
Retrieve all events from src
that have a younger timestamp than the
given one, and reduce them into a different form. Note that if no
init
value is given, then f
should return an 'empty' value when
called with no arguments.
Retrieve all events from `src` that have a younger timestamp than the given one, and reduce them into a different form. Note that if no `init` value is given, then `f` should return an 'empty' value when called with no arguments.
(xmap-event-value src in out)
Returns a new event source that maps in
over the event before
adding them to src
and maps out
over the events retrieved from
src
.
Returns a new event source that maps `in` over the event before adding them to `src` and maps `out` over the events retrieved from `src`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close