module Nn_commit:Two-phase commit protocol
val commit_e :
(bool -> unit) ->
Nn_db.modification Queue.t ->
Nn_state.shared_state_t -> string -> bool Uq_engines.engine
commit_e post_commit journal shared_state debug_name:
Writes the modifications to the local database and all slaves,
and commits the update. The bool arg says whether the commit
was successful. If
false, the transaction is guaranteed to be
rolled back. The commit engine may also enter an error state.
This is considered as a critical violation of the protocol.
If the queue of modification is empty, the local transaction is committed, and no remote operations are involved. (This means that the user only submitted read requests and no writes.)
If there are modifications, a new revision string is created and appended to the journal before anything is written.
Commits are serialized (using
As side effects, the function may disable slaves, and even (self-)disable the coordinator.
The function also invokes
post_commit when the commit or
rollback is done. The bool arg is the same as in the result.
val trans_e :
Nn_state.view_t list ->
'a Uq_engines.engine -> string -> 'a Uq_engines.final_state Uq_engines.engine
let e' = trans_e sh vl e debug_name: Runs the engine
euntil it is finished, and if
ewas successful, the modifications of the views
vlare taken as the modifications to be done in the transaction, and the transaction is committed.
e is not successful,
the views and the db transaction are rolled back.
The returned engine
the transaction is over (after commit or rollback).
st reflects the
final state of
e' reaches an error state only if the commit fails (critical error).