(create reduce-fn init-state data-dir)
(create reduce-fn init-state data-dir opts)
Creates a file-backed stateful-thing.
Available opts:
Creates a file-backed stateful-thing. Available opts: - :prefix the prefix for filenames (default "data-") - :max-file-size the size, in bytes, which triggers rolling over to a new file. the files will not be smaller than this amount, but the amount of overage is bounded by the size of the events. Default is 200000. - :cache-state? whether state cache files will be written when rolling over the files. Default is true. - :edn-options a map of options passed to clojure.edn/read, e.g. to provide particular data readers - :puget-options a map of options passed to puget, e.g. to print particular data literal tags
(update! ag ev)
Given a webscale object created by the created function, and an event, synchronously writes the event to the appropriate files, updates the in-memory state, and returns the new state.
If the reduce-fn throws an exception, this function will throw as well, and the webscale object will remain unaffected.
Exceptions during file IO are currently not handled well, and will result in the webscale object being unusable -- at that point you will want to examine the files manually to see if they need repairing, and then recreate the webscale object.
Given a webscale object created by the created function, and an event, synchronously writes the event to the appropriate files, updates the in-memory state, and returns the new state. If the reduce-fn throws an exception, this function will throw as well, and the webscale object will remain unaffected. Exceptions during file IO are currently not handled well, and will result in the webscale object being unusable -- at that point you will want to examine the files manually to see if they need repairing, and then recreate the webscale object.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close