Pump

Contents

Pump#

ds_engine_pump#

ds_result_t ds_engine_pump(ds_engine_t *engine);

Takes one clock sample, sweeps what has expired, and runs the agenda to exhaustion.

Rules fire only in a pump: until one runs, asserted facts wait in working memory and matched activations on the agenda. No argument bounds one pump’s work, and nothing outside the call can stop it part-way. The sample, its DS_EV_TICK and DS_EV_PUMP come first, then the fact sweep and the cache sweep. Calls are serialised by the integrator. The consumption loop is in Runtime architecture.

A firing’s failure does not stop the pump: the agenda still runs to exhaustion, and the first non-OK result is the pump’s status. The pump’s own failure takes precedence, and an EngineError’s halt over everything. Errors:

Code

Condition

DS_ERR_INVAL

engine is NULL

DS_ERR_STATE

called from inside a callback on this engine (Re-entry)

DS_ERR_ENGINE_HALTED

a firing raised an EngineError during this pump, or the engine had halted before it

DS_ERR_TIME_RANGE

this is the engine’s first sample, and it would put a seeded entry’s deadline outside the Time range; nothing is sampled or recorded

DS_ERR_CONTRACT_BREACH

a cache write in a firing would exceed a cache bound; or, on the engine’s first step, the program’s initial cache items would, and the pump is refused before firing anything

DS_ERR_STORAGE_UNAVAILABLE

a firing’s call met no call callback

DS_ERR_NAN_REJECTED

a firing’s call had a NaN Float argument

DS_ERR_SERIES_NO_BACKING

a series read no declared backing could answer

a callback’s status

the call callback’s, or a cache persistence callback’s, with the meaning its verb gives it; or the first the stream callback returned

DS_ERR_OOM

an allocation failed

An error leaves working memory as the partial pump left it, with no rollback. A later pump continues from there, unless the engine has halted.

(libds.h: ds_engine_pump, Spec: [NLFC.2.1], [NLFC.2.2], [NLFC.2.4], [NERR.15.1], [NERR.15.2], [NTST.3.4])