Files
Baradb/docs/bg/lsm.md
T
dimgigov c55d3080cf
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
Update documentation and clients for v1.1.0
Documentation updates:
- Fix v0.1.0 → v1.1.0 version numbers in en, ru, fa, zh docs
- Add missing Window Functions, Multi-Tenant ERP, Supported Keywords sections
  to ru, fa, zh baraql.md (~105 lines each)
- Expand Turkish and Arabic baraql.md (110 → 268 lines)
- Expand Turkish and Arabic installation.md (62 → 307 lines)
- Add new Bulgarian documentation files (18 new files)

Client updates:
- Python: Full async/await rewrite with asyncio, request queueing
- Rust: Full async/await rewrite with tokio, async examples
- Nim: Update README to v1.1.0
- All clients now support async patterns consistently
2026-05-14 23:05:47 +03:00

2.4 KiB

LSM-Tree Storage Engine

Основният storage engine в BaraDB, използващ Log-Structured Merge-Tree архитектура.

Архитектура

┌─────────────────────────────────────────────┐
│                   Записи                     │
│       (добавяне към WAL + MemTable)          │
└─────────────────────────────────────────────┘
                       │
                       ▼
┌─────────────────────────────────────────────┐
│                  MemTable                    │
│         (в-памет сортиран буфер)              │
└─────────────────────────────────────────────┘
                       │
              (при запълване, flush към SSTable)
                       │
                       ▼
┌─────────────────────────────────────────────┐
│                  SSTable                     │
│    (сортирана string table на диска)          │
└─────────────────────────────────────────────┘

Употреба

import barabadb/storage/lsm

var db = newLSMTree("./data")

# Запис
db.put("key1", cast[seq[byte]]("value1"))

# Четене
let (found, value) = db.get("key1")

# Изтриване
db.delete("key1")

db.close()

Възможности

  • Write-оптимизиран: Append-only лог структура
  • Устойчивост: Write-ahead log (WAL) осигурява crash recovery
  • Bloom Филтър: Бързи негативни проверки
  • Compaction: Size-tiered стратегия слива SSTables
  • Page Cache: LRU кеш за често достъпвани страници

Конфигурация

var db = newLSMTree(
  path = "./data",
  memTableSize = 64 * 1024 * 1024,  # 64MB
  walEnabled = true,
  bloomFpRate = 0.01
)