Skip to content

Execution

Paula Gearon edited this page Mar 7, 2017 · 1 revision

A program may be executed with a call to run.

Namespace: naga.engine
Functions:
    (run config program)

Runs a program on storage described in the config. The program must be created using a call to create-program or else the rules will not be executed correctly.

The config parameter is a map that includes:
:type: The type of the storage. Each store registers its own type. For the internal store, use :memory
:store: Optional. This refers to an existing store. An existing store may or may not contain data. If no store is provided, the remainder of the config will contain information to construct a store of the given type.

e.g.
To create a new store:

(run {:type :memory} program)

To populate a store with data and run against it:

;; get-storage handle uses the same config as the run command
(let [empty-store (store/get-storage-handle {:type :memory})
      data-store (store/assert-data empty-store data-to-be-inserted)]
  (run {:type :memory, :store data-store} program))
Clone this wiki locally