Skip to content
Browse files

doc: Document atomicity of PostgreSQL interactions

Closes: #133
  • Loading branch information
erikd committed Dec 3, 2019
1 parent 637f782 commit 4120b7b5e3c5d75ae208a6c04449cc237751050e
Showing with 30 additions and 0 deletions.
  1. +30 −0 doc/
@@ -0,0 +1,30 @@
# Atomicity of PostgreSQL Interactions

Both the webapi and the node which populates the database operate on the database within a
database transaction. All operations on the database from Haskell code is done in a function
which has a type signatures of :
ReaderT SqlBackend m a
Any function without the `ReaderT SqlBackend` component will not be able to access the database
and any attempt to access the database without the required type signature will result in a compile
error at compile time.

All functions with the required file type are run with the function provided by Haskell's
[Persistent][Persistent] library:
runSqlConnWithIsolation action backend Serializable
* `runSqlConnWithIsolation` is the function that runs the provided `action` on a connection to
the database within a database transaction.
* `action` is the action to be performed on the database (eg write or query).
* `backend` contains the database connection data.
* `Serializable` specifies the transaction isolation level.

In this case the `Serializable` [transaction isolation][PosgresIso] level is used which is the
*maximum* level of transaction isolation.


0 comments on commit 4120b7b

Please sign in to comment.
You can’t perform that action at this time.