ptvp35/docs/source/guarantees.rst
2022-11-20 22:23:52 +00:00

37 lines
1.5 KiB
ReStructuredText

Guarantees
==========
MMDB-level guarantees
---------------
* All 0L writes change MMDB instantly.
* Transaction write works as one atomic write.
Queue-level guarantees
----------------------
This level is the mediator between MMDB and filesystem levels. This level includes the pre-write compression buffer.
* Queue requests occur in the same orders as they were acted upon at MMDB level and in the same order as they will be acted upon at filesystem level.
* DB can't close until all requests are done.
* No request can crash the task.
* Every request eventually succeedes or fails (except for the case of runtime termination).
Buffer-specific guarantees:
* If buffer dump was ever requested, then this request (queued or indirect) will eventually be satisfied.
Filesystem-level guarantees
---------------------------
* If main file exists without .recover or .truncate_flag, then it's valid.
* If .recover file is present, then .backup is valid.
* If .truncate_flag is present, then .truncate is valid and first :code:`.truncate_target()` (contents of .truncate) characters of main file are valid.
* Every write is final and irreversible (can't be reversed unintentionally due to termination), otherwise it's not considered done. That's achieved using :code:`os.fsync`.
Performance guarantees
----------------------
* No normal sync methods (except for :code:`io2db`/:code:`db2io` if they're supplied with blocking :code:`IO`) block on IO. Other methods are explicitly marked with postfix :code:`_sync`.
* All requests are resolved as soon as their conditions are met.