Db Agent - laforge49/aatree GitHub Wiki
Db agent is a component that provides access to a database via an agent. It supports the following API:
- (aatree.db-agent-trait db-agent this) Returns an updated options map (this), which supports the rest of the API.
- (aatree.core.create-db-chan this initial-state) Creates and initializes the db agent.
- (aatree.core.db-get this) Returns the committed contents of the database. Used for queries.
- (aatree.core.db-get-in this [keys]) Uses get-in to return some selected content of the committed state of the database. Used for queries.
- (aatree.core.db-send this f) Uses send to call (f this) in the context of the database for processing. If an exception is thrown by f, the stack trace is logged and the exception is rethrown.
- (aatree.core.db-update this f) Sends the function using db-send and then waits for completion. If :send-update-timeout is specified in opts, then a timeout will occur after the given number of milliseconds.
- (aatree.core.update-get this) Returns the contents of the database. Used while updating the database in place of db-get. Should only be called in the context of an update operation.
- (aatree.core.update-get-in this [keys]) Returns some selected content of the database. Used while updating the database in place of db-get. Should only be called in the context of an update operation.
- (aatree.core.update-assoc-in! this [keys] value) Used to add content to the database. Should only be called in the context of an update operation.
- (aatree.core.update-dissoc-in! this [keys]) Used to remove content from the database. Should only be called in the context of an update operation.
See also Db-agent Options.