OT.Server v0.2.1 OT.Server.ETSAdapter View Source
This is an adapter for OT.Server that stores data and operations in ETS tables.
It is not meant for production use, as all of its data is publicly available for testing purposes.
Link to this section Summary
Functions
Get any conflicting operations for the given datum at the given version
Get the datum identified by the ID
Handle a submission error
Insert the given OT.Server.operation/0
into persistence
Roll a transaction back
Call a function inside of a transaction
Update the OT.Server.datum/0
with the given content and increment its
OT.Server.version/0
Link to this section Functions
Get any conflicting operations for the given datum at the given version.
In a proper OT system, this means any operation for the given datum whose version is greater than or equal to the given version.
The function must return a list of OT.Server.operation_info/0
s.
Callback implementation for OT.Server.Adapter.get_conflicting_operations/2
.
Get the datum identified by the ID.
Callback implementation for OT.Server.Adapter.get_datum/1
.
Handle a submission error.
If the error passed to this function constitutes a scenario in which the
submission should be tried again, return :retry
. Otherwise, return a tagged
error tuple and the call to OT.Server.submit_operation/3
will fail.
Callback implementation for OT.Server.Adapter.handle_submit_error/3
.
Insert the given OT.Server.operation/0
into persistence.
Any metadata that was originally passed to OT.Server.submit_operation/3
will
also be passed to the adapter.
On a successful submission, this value is what will be returned from
OT.Server.submit_operation/3
.
Callback implementation for OT.Server.Adapter.insert_operation/3
.
Roll a transaction back.
This will be called when the attempt to submit an operation fails—for adapters
without real transaction support, they must choose how to repair their data
at this stage, since c:update_datum/2
may have been called, but
c:insert_operation/3
may have failed.
Callback implementation for OT.Server.Adapter.rollback/1
.
Call a function inside of a transaction.
This is useful for adapters that use databases that support transactions. All
of the other adapter functions (other than c:handle_submit_error/3
) will
be call called in the function passed to this function.
This is a good place to implement locking to ensure that only a single operation is processed at a time per document, a requirement of this OT system.
Callback implementation for OT.Server.Adapter.transact/2
.
Update the OT.Server.datum/0
with the given content and increment its
OT.Server.version/0
.
Callback implementation for OT.Server.Adapter.update_datum/2
.