Binds together an index, servers, and streams.
(conj-service core service)
(conj-service core service force?)
Adds a service to a core. Throws if any existing services would conflict. If force? is passed, dissoc’s any conflicting services.
Create a new core.
All services in a core–both the :services list and named services like the index.
(delete-from-index core event)
(delete-from-index core fields event)
Deletes similar events from the index. By default, deletes events with the same host and service. If a field, or a list of fields, is given, deletes any events with matching values for all of those fields.
; Delete all events in the index with the same host (delete-from-index index :host event)
; Delete all events in the index with the same host and state. (delete-from-index index [:host :state] event)
Returns a service which samples instrumented services in its core every interval seconds, and sends their events to the core itself.
(merge-cores old-core new-core)
Merge cores old-core and new-core into a new core comprised of services from :new-core or their equivalents from :old-core where possible.
(reaper interval opts)
Returns a service which expires states from its core’s index every interval (default 10) seconds. Expired events are streamed to the core’s streams. The streamed states have only the host and service copied, current time, and state expired. Expired events from the index are also published to the “index” pubsub channel.
:keep-keys A list of event keys which should be preserved from the indexed event in the expired event. Defaults to [:host :service], which means that when an event expires, its :host and :service are copied to a new event, but no other keys are preserved. The state of an expired event is always “expired”, and its time is always the time that the event expired.
Start the given core. Reloads and starts all services.
Stops the given core and all services.
(stream! core event)
Applies an event to the streams in this core.
(transition! old-core new-core)
A core transition “merges” one core into another. Cores are immutable, but the stateful resources associated with them aren’t. When you call (transition! old-core new-core), we:
Stop old core services without an equivalent in the new core.
Merge the new core’s services with equivalents from the old core.
Reload all services with the merged core.
Start all services in the merged core.
Finally, we return the merged core. old-core and new-core can be discarded.
(update-index core event)
Updates this core’s index with an event.
(wrap-index source registry)
Wraps an index, exposing the normal Index and IFn protocols. If a second argument is present it should implement the PubSub interface and will be notified when events are updated in the index.