Module

Perspectives.Persistent

Instances of contexts and roles (represented as PerspectContext and PerspectRol respectively) are stored in Couchdb. Before they are stored, and when they are retrieved, they are cached. On saving a document to Couchdb, it receives a Couchdb version parameter _rev. However, because of the way we serialise our data, we do not 'see' that parameter in our types when they are fetched and deserialized (Couchdb adds them to the outer JSON value, which is thrown away by generic deserialisation).

Therefore we have added a _rev parameter to our types and on receiving a JSON document from Couchdb, we set the actual revision value (sent in the HTTP headers as well) in our data.

Warning to implementers: in Couchdb you will therefore see two _rev parameters: an outer one with the correct version, and an inner one that is always one step behind.

#saveEntiteit

saveEntiteit :: forall a i r. GenericEncode r => Generic a r => Persistent a i => i -> MonadPerspectives a

Save an entity, whether it has been saved before or not. It must be present in the cache. On success it will have the same version in cache as in Couchdb.

#removeEntiteit

removeEntiteit :: forall a i. Persistent a i => i -> MonadPerspectives a

Remove from Couchdb and on success remove from the cache, too.

#getPerspectEntiteit

getPerspectEntiteit :: forall a i. Persistent a i => i -> MonadPerspectives a

#tryGetPerspectEntiteit

Modules