Module holmes::pg [] [src]

Postgres-based Fact Database

Design Notes

Scope

The general philsophy is that things having to do with persistence go here, while things related to non-persistent components go in holmes::engine.

In the long run, we would like to persist nearly everything in the database, so that a client-server model can one bay restored. However, in the short term this has little benefit, so only the items needing to use SQL for efficient execution are being included.

The biggest hurdle here is the persistence of code:

  • How do we store Types?
  • How do we store bound functions?

One possible long term answer is Cap'n' Proto SturdyRefs

Other Databases

For the moment, this is the only implementation, and there are no others on the horizon, so this interface is not abstract.

The only major hurdle to using another backend would be figuring out how to make the dyn module abstract over databases.

Modules

dyn

This module provides extensible, dynamically typed persistable values for use in the Holmes language and postgres db. TODO put a demo on custom types in here

Structs

Error

The Error type.

PgDB

Object representing a postgres-backed fact database instance

RowIter

An iterator over a postgres::rows::Row. It does not implement the normal iter interface because it does not have a set item type, but it implements a similar interface for ease of use.

Enums

ErrorKind

The kind of an error.

Traits

ResultExt

Additional methods for Result, for easy interaction with this crate.

Type Definitions

Result

Convenient wrapper around std::Result.