e1bae0c7a0
- Add docs/ folder with English (en/) and Bulgarian (bg/) documentation - Create index.md with language switching and links - English docs: installation, quickstart, architecture, baraql, storage, schema, lsm, btree, vector, graph, fts, columnar, transactions, distributed, protocol, udf, api-binary, api-http, api-websocket - Bulgarian docs: installation, quickstart, architecture, baraql, schema, lsm, btree, vector, graph, fts, transactions, distributed - Update README license to BSD 3-Clause - Add LICENSE file with BSD 3-Clause text
27 lines
695 B
Markdown
27 lines
695 B
Markdown
# Транзакции & MVCC
|
|
|
|
Multi-Version Concurrency Control със snapshot изолация.
|
|
|
|
## Употреба
|
|
|
|
```nim
|
|
import barabadb/core/mvcc
|
|
|
|
var tm = newTxnManager()
|
|
let txn = tm.beginTxn()
|
|
|
|
discard tm.write(txn, "key1", cast[seq[byte]]("value1"))
|
|
discard tm.write(txn, "key2", cast[seq[byte]]("value2"))
|
|
|
|
tm.savepoint(txn)
|
|
discard tm.rollbackToSavepoint(txn)
|
|
|
|
discard tm.commit(txn)
|
|
```
|
|
|
|
## Изолация
|
|
|
|
BaraDB използва **snapshot isolation**:
|
|
- Читателите не блокират писатели
|
|
- Писателите не блокират читатели
|
|
- Всяка транзакция вижда консистентен моментна снимка |