Belső működés · §1

Repository layout

Ez az oldal a nucleus saját dokumentációjából készül, ezért angol nyelvű.

Path Crate Contents Milestone
crates/platform nucleus-platform file system, clock and randomness traits; real and simulated implementations; simulation harness §M0
crates/storage nucleus-storage page format, pager, buffer pool, B+tree, WAL, store, engines behind it (§4.6) §M1–§M4 ✅, §M14.28 L1
crates/txn nucleus-txn MVCC, snapshot isolation, GC §M5 ✅
crates/kv nucleus-kv the KV contract and the local Database §M6 ✅
crates/range nucleus-range the keyspace cut into ranges: descriptors, the router, splits and merges — a KV implementation over the local one (§6.6) §M18
crates/kernels nucleus-kernels the vectorized executor’s batch kernels, compiled per CPU level and chosen at run time; a neural network’s forward pass (f32 matrix product, GELU, softmax, layer normalization) §M14.20, §M14.22
crates/sql nucleus-sql types, encodings, catalog (nc_catalog), parser, binder, optimizer, executor, sessions; the extension API (ext) §M7–§M14.5, §M14.19
crates/wire nucleus-wire the nucleus protocol’s wire format, for both ends: versions, message kinds, value tags, frames, values, the columnar layout (§10) §M14.20 W8
crates/server nucleus-server front ends (the nucleus protocol), authentication §M12, §M14.7, §M14.19
crates/client nucleus-client the Rust driver §M14.6–§M14.8 ✅
crates/testkit nucleus-testkit the sqllogictest runner and the SQL layer’s scripts, for the core, front ends and modules §M14.19
modules/pg-compat nucleus-pg-compat PostgreSQL compatibility: the protocol, pg_catalog, information_schema, the pg_* functions (its own README) §M12, §M14.5, §M14.19
modules/mongo-compat nucleus-mongo-compat MongoDB compatibility: the wire protocol’s CRUD and queries over collections, BSON as Extended JSON (§8.42; its own README) §M16 Q5
modules/ndjson nucleus-ndjson the sample protocol adapter: newline-delimited JSON over TCP onto streams’ appends and entries from a seq (§8.46; its own README) §M16.5 S6
modules/tls nucleus-tls TLS over rustls, for the front ends and the Rust client §M14.25 ✅
modules/oidc nucleus-oidc OpenID Connect: logins by identity tokens §M14.25 ✅
modules/ldap nucleus-ldap LDAP: passwords checked by a directory §M14.25 ✅
modules/http nucleus-http just enough HTTP/1.1 over TLS for the modules that call out (oidc, embeddings) §M14.22
modules/embeddings nucleus-embeddings embedding model providers: OpenAI-compatible endpoints, Cohere, Voyage (§8.23) §M14.22
modules/local-models nucleus-local-models the local model provider: models run inside nucleus — WordPiece and Unigram tokenizers, BERT and XLM-RoBERTa encoders on ext::kernels, files from Hugging Face or a directory kept in the database (§8.23) §M14.22
modules/mcp nucleus-mcp a Model Context Protocol server: AI models list, describe and query a database (§6.5) §M14.10
modules/console nucleus-console the web console: a front end serving a page to browse tables, run SQL, see plans drawn and the linter’s findings (§9) §M14.17
modules/prometheus nucleus-prometheus Prometheus: the metrics as GET /metrics (text format, OpenMetrics) and the health checks /health/live, /health/ready, /health/primary, /health/replica (§8.38, §9) §M14.18, §M17.5
modules/otlp nucleus-otlp OpenTelemetry: the metrics pushed to a collector over OTLP/HTTP (§8.38) §M14.18
modules/signals nucleus-signals stop requests: SIGTERM, SIGINT, SIGHUP (Ctrl-C, Ctrl-Break, a console closing on Windows) handed to the server as a call, through the ctrlc crate — the core has no signal handling (§9) issue #17
modules/aws nucleus-aws what the AWS modules share: Signature Version 4, credentials, region and endpoint from the AWS SDKs’ variables §M14.18, §M14.30
modules/s3 nucleus-s3 Backups in S3-compatible object storage (s3://bucket/prefix), AWS Signature Version 4 (§8.30) §M14.18
modules/pkcs11 nucleus-pkcs11 the keyring’s root key in an HSM or any PKCS#11 token (--root-kms 'pkcs11:token=<t>;object=<k>?module-path=<lib>&pin-source=<file>', RFC 7512): data keys encrypted in the token by an AES-256 key with AES-GCM, the purpose as additional authenticated data; through cryptoki; tests against SoftHSM2 §M14.30
modules/azure-kv nucleus-azure-kv the keyring’s root key in Azure Key Vault (--root-kms azure-kv:<vault>/<key>): data keys encrypted by the vault’s RSA key (RSA-OAEP-256), the purpose bound inside; tokens from a service principal, workload identity or a managed identity; a stand-in Key Vault for tests (mock) §M14.30
modules/gcp-kms nucleus-gcp-kms the keyring’s root key in Google Cloud KMS (--root-kms gcp-kms:projects/…/cryptoKeys/<k>): data keys encrypted there, the purpose as additional authenticated data; tokens from application default credentials; a stand-in Cloud KMS for tests (mock) §M14.30
modules/vault-transit nucleus-vault-transit the keyring’s root key in Vault’s or OpenBao’s Transit engine (--root-kms vault-transit:[<mount>/]<key>): data keys encrypted there, the purpose as associated data; a stand-in engine for tests (mock) §M14.30
modules/aws-kms nucleus-aws-kms the keyring’s root key in AWS KMS (--root-kms aws-kms:<key>): data keys wrapped by Encrypt, unwrapped by Decrypt; a stand-in KMS for tests (mock) §M14.30
editions/nucleus nucleus-cli (binaries nucleus, ncsql) the full edition: nucleus kv, nucleus sql / ncsql, nucleus server with every front end, nucleus mcp §M6, §M12, §M14.6 ✅
editions/embedded nucleus-embedded (a cdylib, staticlib and rlib) the embedded edition: a database in memory or in a directory inside the application, its sessions over the nucleus protocol through a pipe in the process, behind a C API (include/nucleus_embedded.h) that Python and Node load (§11, In the process); for wasm32-wasip1 the browser’s, its sessions stepped (§11, In the browser) §M14.23
integrations/d-os nucleus-dos-settings (binary nucleus-settings) the d-os settings service and app manifest §M6, §M6.5 ◐
drivers — drivers for C, C++, Python, JS/TS, Java, Swift (§11); Python’s platform wheel (build_wheel.py) and JavaScript’s Node-API addon (native/) for the embedded edition; JavaScript’s browser entry (src/browser.ts, the engine in WebAssembly, wasm/build.sh); iOS — the Swift package’s NucleusEmbedded over NucleusEmbedded.xcframework (swift/build-xcframework.sh) — and Android, a Kotlin library (android/, an AAR) §M14.8 ✅, §M14.23
examples nucleus-example (Rust) the quickstart in every driver’s language §M14.8 ✅
playground — the console’s page on the browser edition, the tutorial as its tour; build.sh (a static site), test.mjs (headless Chrome) §M14.17
examples/extension nucleus-example-extension (binary geo-demo) the sample module geo: a type, a function, a catalog view; the guide for writing a module (its README) §M14.19 ✅
scripts — package.sh (archives, .deb, .rpm), install.sh / install.ps1 (a release installed, its sums checked), manifests.sh (the Homebrew formula, the winget manifests), image-context.sh (the image’s build context), psql-smoke.sh, driver-tests.sh, ci-tools.sh (CI’s tools for running its scripts locally), precheck.sh (what CI would find on other platforms, before a push), s3-test.sh, kms-test.sh; gen-word-breaks.py, gen-stop-words.py (the text analyzers’ tables, §8.19) §M6, §M12, §M14.8, §M14.17, §M14.21
packaging — the container image’s Dockerfile (§6.3) §M14.17
monitoring — Prometheus alert rules and their promtool tests, a Grafana dashboard, test.sh (the real Prometheus and OpenTelemetry Collector against a server; MIT, to copy from) (§8.39) §M14.18
docs/llm.md — the dialect for AI models: what there is, what is missing and what to use instead, the catalog, hints, the analyzer §M14.10 ✅
docs/memory.md — the guide to memory for AI applications: a knowledge base with citations, a memory per user, read records, erasure, backups — in SQL, Python, JavaScript and over MCP §M14.24 ✅
docs/benchmarks.md, bench/ — the benchmark suite against PostgreSQL (bench/run.py, run in CI, --engines btree,lsm a system a table engine; wamp/wamp.py, write amplification, --engine=lsm, --values=random; crates/sql/tests/ycsb.rs, YCSB A, B and E on either engine; tpch.py, clickbench.py; phases.py, one build against another step by step; bench/ann/, the HNSW storage models on the KV with hnswlib and pgvector as references, and sql.py, the index through SQL; bench/text/, the full-text data), its latest results and targets §M14.11, §M14.12 V4, §M14.21

crates/ is the core and the public API crates; modules/ are modules, each a folder built to leave the repository (its own README, changelog, licence and version; dependencies on the public API crates only, by version and path; in code, of nucleus-sql only nucleus_sql::ext); editions/ are the builds that choose modules. scripts/check-boundaries.py checks this both ways and scripts/detach-test.sh builds and tests every module from its packaged form alone (§2).

Workspace-wide: Rust edition 2024, toolchain pinned in rust-toolchain.toml (rustup installs it on first use), unsafe_code forbidden, missing_docs warned, clippy warnings are errors in CI. One exception to the first: nucleus-kernels denies unsafe code instead and allows it in its kernel! macro alone, to call a kernel’s copy compiled for a CPU feature once the CPU was found to have it (§8.5).