Repository map

This page lists every directory under src/ and every source file outside src/protocol/<wire>/, one line each. For the wire subdirectories there is one line per directory. Descriptions are condensed from each file's //! module documentation and checked against call sites where the page says so. Line counts are approximate (wc -l style) at main 8a689c5c.

Claims a module doc makes about itself ("512-bit security", "enterprise-grade", "production-quality", "100% data cohesiveness", "HIPAA-compliant") are not repeated here as fact. Where a module is compiled but nothing outside it calls it, the row says Not wired. That was checked by searching src/ for the module path and its public type names outside the module itself.

Totals by directory

Directory Files Lines Purpose
src/ (root files) 8 about 3,300 Entry points, config, errors, allocator accounting, operator subcommands
src/auth/ 16 about 8,900 Authentication, roles and privileges, RLS, audit trail
src/bin/ 2 about 700 synergydb-cli and synergydb-migrate
src/catalog/ 7 about 3,100 System catalog: users, roles, databases, sequences, bootstrap
src/distributed/ 9 about 11,000 Raft, replication hook, RPC, and unwired 2PC/sharding code
src/index/ 16 about 9,500 Index structures; most are not on the live path (see below)
src/migrate/ 14 about 8,600 Import engine and source connectors
src/observability/ 6 about 2,900 Prometheus metrics, OpenTelemetry tracing, metering
src/plan/ 13 about 21,500 Logical plan, optimizer, executor, EXPLAIN, privileges, RLS injection
src/protocol/ 176 about 302,000 One subdirectory per wire, plus shared TLS, limits and timeouts
src/proxy/ 20 about 24,000 Encryption proxy. Not wired into the server
src/query/ 49 about 152,000 The SQL engine and the other query-language front ends
src/server/ 1 about 1,300 Starts listeners, cluster wiring, shutdown
src/storage/ 24 about 34,500 LSM engine, WAL, SSTables, compaction, at-rest encryption, backup
src/transaction/ 5 about 5,600 MVCC, SSI, locks, advisory locks
src/types/ 6 about 2,800 Value, schema, record and vector types
src/vector/ 5 about 4,500 Wire-neutral vector search service

(source: file tree of src/; //! docs of each file)

Outside src/, the repository has benches/ (four Criterion benches), tests/ (56 Rust integration test files, 3 shell scripts and a protocol_helpers module), prove/ (the proof pack), test-scripts/ (differential and matrix suites), proto/ (the gRPC schema), docker/, deploy/, apps/ and docs/ (status entries and proof outputs) (source: repository tree).

Root files

File Lines Purpose
src/lib.rs 82 Declares the crate's modules, installs the global allocator (heap::Counting over mimalloc or the system allocator) and holds lock_dev_insecure_auth_env(), which serializes tests that toggle the dev-auth env var.
src/main.rs 739 Server binary. Dispatches the operator subcommands, parses flags, sets up tracing, raises the open-files limit, builds a 64-worker tokio runtime and refuses to start with auth-disabling env vars on a non-loopback bind.
src/config.rs 1149 TOML configuration with SYNERGYDB_<SECTION>_<KEY> env overrides. Wire ports are Option<u16>: a key missing from a config file leaves that wire off.
src/error.rs 217 The crate's Error and Result types.
src/heap.rs 407 Live-heap byte counting behind SYNERGYDB_MEMORY_LOG_SECS.
src/audit_cmd.rs 215 synergydb audit verify and generate-key for the hash-chained audit trail.
src/backup_cmd.rs 396 synergydb backup, restore and backup-verify for a stopped server's data directory.
src/encryption_cmd.rs 309 synergydb encryption status, rewrite and generate-key.

(source: each file's //! docs; src/main.rs, main; src/lib.rs)

src/auth

File Lines Purpose
mod.rs 49 Module root for role-based access control.
wire_auth.rs 621 Shared credential checks for every wire: timing-safe verify with a dummy Argon2id hash, failed-login backoff, dev insecure auth switch, Redis-style protected mode, per-wire roles (synergy_wire_<wire>, synergy_wire_all) and HTTP Basic helpers.
password.rs 389 Argon2id password hashing.
scram.rs 338 Server side of SCRAM-SHA-256 for the PostgreSQL wire.
verify_cache.rs 303 Cache of verified credentials with single-flight for the password KDF.
acl.rs 657 PostgreSQL-style ACL parsing and evaluation.
grant.rs 474 GRANT and REVOKE logic.
permission.rs 510 Privilege types and permission checks.
cache.rs 559 LRU cache for permission lookups.
column_security.rs 445 Column-level access control.
rls.rs 422 Row-level security policy types.
session.rs 489 Session context with authentication fields.
audit.rs 1331 Security audit events and logging.
audit_chain.rs 919 Append-only, hash-chained JSON-lines storage for the audit trail.
aws_keys.rs 552 AWS access-key provisioning and a shared SigV4 verifier used by the S3 and DynamoDB wires.
secrets.rs 816 External secrets providers. Compiled only with the rest-api feature.

(source: src/auth/*.rs, //! docs; src/auth/secrets.rs, cfg(feature = "rest-api"))

src/bin

File Lines Purpose
cli.rs 84 synergydb-cli. A stub.
migrate.rs 610 synergydb-migrate. Source connectors are behind the migrate-* features.

(source: src/bin/cli.rs; src/bin/migrate.rs)

src/catalog

File Lines Purpose
mod.rs 25 Module root: users, roles, membership, databases.
bootstrap.rs 444 First-boot setup: superuser creation, system schema, default roles.
credentials.rs 126 Password policy shared by bootstrap and synergydb passwd.
repository.rs 867 CRUD for system catalog tables.
system_tables.rs 1065 Schemas of the system catalog tables, stored in the LSM under catalog key prefixes.
sequence.rs 483 SQL sequences.
compatibility.rs 139 Predicates that classify catalog entries for cross-wire use.

(source: src/catalog/*.rs, //! docs)

src/distributed

File Lines Purpose
mod.rs 247 Module root and re-exports.
raft.rs 3370 Raft: election, log replication, snapshots. Started by Server::init_cluster when [cluster] asks for it.
raft_storage.rs 1766 File-based persistent Raft log and state.
rpc.rs 1845 Raft RPC: length-prefixed bincode frames over TCP.
replication.rs 505 RaftReplicationHook: routes StorageEngine::write_batch through Raft as a resolved ReplicatedWrite { entries, timestamp }.
node_role.rs 131 Process-wide view of the node's cluster role, for wires and health checks.
coordinator.rs 2459 Two-phase commit coordinator and participant. Not wired: no code outside src/distributed/ uses it.
shard.rs 271 Consistent hashing and ShardManager. Not wired.
circuit_breaker.rs 432 Circuit breaker. Not wired.

(source: src/distributed/*.rs; src/server/mod.rs, init_cluster; src/storage/mod.rs, ReplicationHook)

src/index

The SQL path's live secondary indexes are not in this directory. They are the SecondaryIndexEntry registry in src/storage/mod.rs (equality, range and GIN containment) and the HNSW graph built by CREATE INDEX ... USING hnsw in src/query/engine.rs. The wire-neutral vector service in src/vector/ also uses index::hnsw (source: src/storage/mod.rs, SecondaryIndexEntry; src/query/engine.rs, USING hnsw branch; src/vector/mod.rs).

File Lines Purpose
mod.rs 369 Index traits and an IndexManager. The engine holds an IndexManager, but nothing calls create_fulltext_index or create_vector_index on it, so its index-update hooks never find an index.
hnsw.rs 1654 HNSW graph. Used by the SQL HNSW index and by src/vector/.
graph.rs 516 Adjacency index. Used by the Gremlin wire's traversal code.
btree.rs 385 In-memory B+tree. Not wired.
gin.rs 750 Inverted index for JSONB and arrays. Not wired: the live GIN index is the storage registry's gin_terms.
fulltext.rs 465 Tantivy full-text index. Not wired (see IndexManager above). PostgreSQL tsvector search lives in src/query/fts.rs instead.
diskann.rs 517 DiskANN vector index. Not wired.
ivf_pq.rs 312 IVF-PQ vector index. Not wired.
tiered.rs 1072 Hot/warm/cold tiering across HNSW, DiskANN and IVF-PQ. Not wired.
btree_persistent/mod.rs 23 Disk-based B+tree module root. Not wired as a whole.
btree_persistent/tree.rs 833 B+tree operations.
btree_persistent/page.rs 872 8 KB pages.
btree_persistent/buffer_pool.rs 755 LRU page cache with pin counts.
btree_persistent/file.rs 492 Page file I/O and header.
btree_persistent/wal_entries.rs 333 B+tree WAL record types.
btree_persistent/recovery.rs 201 B+tree WAL replay.

(source: src/index/*.rs; searches of src/ for each module and type name outside src/index/)

src/migrate

File Lines Purpose
mod.rs 489 Module root and re-exports.
engine.rs 988 Orchestrates a migration run. Also defines a QueryRouter.
schema.rs 509 Maps source schemas and records the source dialect.
source.rs 451 MigrationSource trait and shared types.
target.rs 333 Target writer abstraction.
stream.rs 599 Batching and streaming.
state.rs 658 Progress state for resumable runs.
verify.rs 567 Post-migration verification checks.
source/postgres.rs 669 PostgreSQL source (tokio-postgres, feature migrate-postgres).
source/mysql.rs 638 MySQL and MariaDB source (mysql_async, feature migrate-mysql).
source/sqlite.rs 536 SQLite source (rusqlite, feature migrate-sqlite).
source/mongodb.rs 670 MongoDB source (mongodb, feature migrate-mongodb).
source/couchdb.rs 797 CouchDB source over HTTP (feature migrate-couchdb).
source/file.rs 649 CSV, JSON and Parquet file sources.

(source: src/migrate/*.rs; Cargo.toml, [features])

src/observability

File Lines Purpose
mod.rs 29 Module root.
metrics.rs 418 Prometheus metrics, including the ConnectionTracker each wire creates per connection.
tracing.rs 357 OpenTelemetry tracing setup.
metering.rs 634 Usage metering. Reached from the HTTP routes.
lineage.rs 937 Data lineage tracking. Not wired: used only inside src/observability/.
resources.rs 514 Resource-exhaustion manager. Not wired: used only inside src/observability/.

(source: src/observability/*.rs; src/protocol/http/routes.rs)

src/plan

File Lines Purpose
mod.rs 58 Module root and re-exports.
logical.rs 2033 LogicalPlan, the shared plan form for SQL, MQL, Cypher and the others.
optimizer.rs 3424 Rule-based rewrites plus a cost-based reorder of two-table inner equi-joins that runs only when ANALYZE statistics exist. On by default; SYNERGYDB_OPTIMIZER=0, false or off turns it off.
cost_model.rs 1298 Cost estimates used by the optimizer.
statistics.rs 1717 Table and column statistics.
stats_collector.rs 1496 Sample-based statistics collection.
adaptive.rs 1666 Adaptive optimizer that learns from execution feedback. Referenced from optimizer.rs.
physical.rs 462 PhysicalPlan types.
physical_planner.rs 1013 Index-aware physical planner. Not wired: the engine lowers plans with its own logical_to_physical.
executor.rs 3727 QueryExecutor over physical plans. The engine holds one and runs physical plans through it. It has its own evaluate_expr.
explain.rs 1439 EXPLAIN and EXPLAIN ANALYZE output. Reports the real access method and a cost proportional to estimated rows when statistics are supplied; otherwise it prints placeholder costs, as its module doc says.
privileges.rs 835 Works out which relations a statement touches and how, for privilege checks.
rls_injector.rs 2305 Injects row-level security predicates into plans.

(source: src/plan/*.rs; src/query/engine.rs, optimizer_enabled and logical_to_physical)

src/protocol

Shared files

File Lines Purpose
mod.rs 314 Declares every wire module and the ProtocolHandler trait (name, default_port, start). Also holds accept_error, the shared accept-loop error handler.
tls.rs 647 rustls-based TLS for every wire (TlsListener, MaybeTlsStream).
buffer_limits.rs 474 Message and query size limits.
timeout.rs 410 Read and write timeouts on connection streams.
rate_limiter.rs 299 Authentication rate limiting.
pool.rs 1236 Generic connection pool. Not wired: referenced only from its own doc example.

(source: src/protocol/*.rs)

Wire subdirectories

Every directory below is started by Server::start when its port key is set. See Adding a wire for how that works, and the wire guides for what each wire supports.

Directory Files Lines Wire Port key
postgres/ 7 about 25,000 PostgreSQL frontend/backend protocol v3, including the system catalog emulation postgres_port
mysql/ 8 about 10,600 MySQL client/server protocol mysql_port
mongodb/ 6 about 17,600 MongoDB OP_MSG with BSON, plus legacy OP_QUERY for the handshake mongodb_port
bolt/ 8 about 20,500 Neo4j Bolt with Packstream and a Cypher evaluator bolt_port
http/ 4 about 8,100 REST API and GraphQL endpoint. Routes need the rest-api feature. http_port
grpc/ 7 about 4,500 SynergyDB's own gRPC service from proto/synergydb.proto. Needs the grpc feature. grpc_port
redis/ 12 about 25,500 RESP2 and RESP3 redis_port
memcached/ 2 about 4,400 Memcached text and binary protocols on one port memcached_port
cassandra/ 8 about 13,700 CQL binary protocol cassandra_port
elasticsearch/ 12 about 19,400 Elasticsearch REST API, Query DSL, aggregations, kNN elasticsearch_port
couchdb/ 6 about 6,300 CouchDB HTTP API over a revision-tree store; views run in embedded QuickJS couchdb_port
oracle/ 12 about 21,800 Oracle TNS oracle_port
mssql/ 8 about 19,900 SQL Server TDS mssql_port
dynamodb/ 4 about 6,200 DynamoDB HTTP/JSON API, condition and update expressions, PartiQL dynamodb_port
clickhouse/ 6 about 13,700 ClickHouse native protocol and HTTP interface clickhouse_port, clickhouse_http_port
snowflake/ 4 about 16,800 Snowflake REST API snowflake_port
influxdb/ 2 about 7,500 InfluxDB line protocol and HTTP API, on storage::timeseries influxdb_port
kafka/ 9 about 6,900 Single-node Kafka broker over the shared storage engine kafka_port
schema_registry/ 5 about 5,900 Confluent Schema Registry REST API schema_registry_port
s3/ 5 about 7,300 S3 REST API with SigV4 s3_port
prometheus/ 15 about 11,300 Prometheus remote read/write and PromQL prometheus_port
gremlin/ 8 about 11,900 TinkerPop Gremlin over WebSocket, GraphBinary and bytecode gremlin_port
sqlite/ 6 about 7,600 SQLite and libSQL compatibility sqlite_port
arrow/ 6 about 6,600 Arrow Flight and Flight SQL over gRPC (flight_grpc.rs, flight_sql.rs). The arrow/mod.rs doc still says the endpoint is not wire-compatible with Arrow Flight, which describes the older code that flight_grpc.rs replaced. arrow_flight_port

(source: src/protocol/<wire>/mod.rs //! docs; src/server/mod.rs, Server::start; src/config.rs, ServerConfig; src/protocol/arrow/flight_grpc.rs)

src/proxy

A transparent encryption proxy for PostgreSQL and MySQL backends, with its own access control, masking, key rotation, KMS client and audit store.

Not wired: no file outside src/proxy/ references crate::proxy. The server binary never constructs the proxy. Its tests run as library unit tests only (source: search of src/ for proxy::; src/server/mod.rs; src/main.rs).

File Lines Purpose
mod.rs 598 Proxy setup and master-key loading. Refuses the constant mock KMS key unless SYNERGYDB_DEV_INSECURE_AUTH is set.
handler.rs 3046 Client connection handling with encrypt/decrypt on the way through.
pg_auth.rs 1050 MD5 and SCRAM authentication for proxied PostgreSQL.
pool.rs 1779 Backend connection pool.
access.rs 2372 Proxy-side access control.
tls.rs 363 TLS and optional mutual TLS.
rate_limit.rs 389 Login brute-force protection.
query_rate_limit.rs 505 Per-user and per-database token-bucket query limits.
query/mod.rs 854 Rewrites SQL for encrypted columns.
schema/mod.rs 733 Tracks which columns are encrypted.
masking/mod.rs 664 Field masking patterns.
crypto/mod.rs 68 Crypto module root.
crypto/engine.rs 865 AES-256-GCM with HMAC-SHA-512.
crypto/key_derivation.rs 597 PBKDF2-SHA-512 per-column keys.
crypto/rotation.rs 1625 Key rotation workflow.
crypto/kms.rs 1501 KMS client; AWS KMS behind the aws-kms feature, plus a mock provider for tests.
audit/mod.rs 1358 Proxy audit events.
audit/persistence.rs 2798 File and SQLite audit backends (SQLite needs migrate-sqlite).
healthcare_migration_demo.rs 2078 Demo test; its live-database test is ignored and needs --features migrate-all.
healthcare_test.rs 757 Integration-style tests for the proxy crypto path.

(source: src/proxy/*.rs; src/proxy/mod.rs, KMS key loading)

src/query

File Lines Purpose
mod.rs 152 Declares the language front ends and QueryCompiler, which routes SQL, MQL, Cypher, SPARQL, GraphQL and SynergyQL to their parsers. Nothing constructs QueryCompiler.
engine.rs 96406 QueryEngine, the SQL engine behind the PostgreSQL wire and most SQL-speaking wires: parsing, planning, execution, catalog emulation, typed parameter binding, transactions. Read it in targeted ranges; never whole.
engine_app_install_tests.rs 1034 Regression tests from installing real applications over the PostgreSQL wire.
engine_gitlab_tests.rs 488 Regression tests from running GitLab.
engine_hub_walk_tests.rs 532 Regression tests from walking the hub apps on the cluster.
engine_wire_types_tests.rs 384 Result types and values real apps read over the PostgreSQL wire.
engine_plpgsql_locals_tests.rs 251 PL/pgSQL DECLARE locals and pgcrypto digest().
engine_array_subquery_tests.rs 103 ARRAY(SELECT ...) results.
sql/lexer.rs 1504 SQL tokenizer.
sql/parser.rs 14451 SQL parser to LogicalPlan.
sql/mod.rs 86 SQL front end root.
plpgsql.rs 3092 PL/pgSQL interpreter.
triggers.rs 962 Trigger catalog types and trigger-body parser.
constraints.rs 676 Foreign key enforcement.
cursor.rs 481 Server-side named cursors (materialized at DECLARE).
aggregates.rs 441 Aggregate functions.
json_ops.rs 663 JSON operators.
fts.rs 1882 PostgreSQL full-text search (to_tsvector, tsquery).
pgvector.rs 655 pgvector type I/O, typmod checks and distance operators.
inet.rs 170 inet and cidr containment.
mysql_funcs.rs 1882 MySQL built-ins and result formatting for the MySQL wire.
mssql_funcs.rs 1721 SQL Server built-ins the TDS translator emits as __tds_* calls.
sqlite_fns.rs 1296 SQLite scalar functions for the SQLite wire.
pg_keywords.rs 498 Keyword list for pg_get_keywords().
schema_ns.rs 192 Schema namespaces: non-default schemas are stored as <schema>\x1f<name>.
stmt_cache.rs 412 Prepared statement cache.
slow_log.rs 325 Slow-query log (SYNERGYDB_SLOW_QUERY_US, SYNERGYDB_SLOW_QUERY_LOG).
types.rs 513 Engine types: PostgreSQL OIDs, column info, results, timeouts.
mql/ (5 files) about 4,300 MongoDB query and pipeline lexer, parser and planner to LogicalPlan. The MongoDB wire uses its BSON types.
cypher/ (5 files) about 4,100 Cypher lexer, parser and planner to LogicalPlan.
graphql/ (4 files) about 4,300 GraphQL schema generation, introspection and subscriptions. Reached from the HTTP routes.
sparql/ (6 files) about 7,700 SPARQL 1.1 parser, planner, executor and RDF model. Not wired: reachable only through QueryCompiler, and QueryEngine returns "SPARQL queries not supported in QueryEngine".
synergyql/mod.rs 40 SynergyQL analyzer stub, referenced by the HTTP and gRPC models.

(source: src/query/*.rs; src/query/engine.rs, SPARQL branch; src/protocol/http/routes.rs)

src/server

File Lines Purpose
mod.rs 1271 Server: bootstrap, init_cluster (Raft and the replication hook), one if let Some(port) block per wire, start_handler (pre-binds the port so a clash fails startup, then spawns the listener) and ordered shutdown.

(source: src/server/mod.rs)

src/storage

File Lines Purpose
mod.rs 8786 StorageEngine: write path, group commit, scans, the secondary-index registry, replication hook and memtable rotation.
wal.rs 2276 Write-ahead log.
memtable.rs 1247 Concurrent skip-list memtable (crossbeam).
sst.rs 3444 SSTables and the sharded CLOCK block cache (SYNERGYDB_BLOCK_CACHE_MB).
manifest.rs 1074 SSTable manifest per level.
compaction.rs 1862 Background compaction and the two-phase delete of obsolete files.
recovery.rs 1085 Crash recovery and WAL validation.
namespaced.rs 1222 Per-database view: prefixes every key with db:<name>\x1f; __databases__:* stays global.
columnar.rs 510 Column projections of large SSTables for analytic scans.
crypto.rs 263 AES-256-GCM block encryption for SST blocks and WAL entries.
keyring.rs 948 HKDF-SHA-512 subkeys per purpose and tenant.
at_rest.rs 991 Master key loading and rotation, data-directory key check, encryption status and rewrite.
backup.rs 2183 Backup and restore.
backup_scheduler.rs 642 Cron-style backup scheduling. Not wired.
property_oracle_tests.rs 935 Seeded property test of the engine against a BTreeMap oracle.
parquet/ (5 files) about 4,700 Parquet reader, writer, encodings and schema mapping. Not wired: no code outside the directory uses it.
timeseries/ (4 files) about 2,350 Time-series store with buffering, downsampling and retention. Used by the InfluxDB wire.

(source: src/storage/*.rs; searches for backup_scheduler:: and parquet:: outside their directories; src/protocol/influxdb/mod.rs)

src/transaction

File Lines Purpose
mod.rs 53 Module root.
mvcc.rs 2362 Versions, snapshots and IsolationLevel (ReadUncommitted, ReadCommitted, SnapshotIsolation, Serializable).
ssi.rs 376 Key-level SSI tracker: aborts a committing SERIALIZABLE transaction with SQLSTATE 40001 on a dangerous rw-dependency structure.
lock.rs 2484 Lock manager with deadlock detection.
advisory.rs 284 PostgreSQL advisory locks, session and transaction scoped.

(source: src/transaction/*.rs)

src/types

File Lines Purpose
mod.rs 179 Module root.
value.rs 534 The Value enum.
schema.rs 569 Table and column schema, IndexType (lists DiskANN, IVF-PQ and full-text variants that the live path does not build).
record.rs 302 Record type.
vector.rs 348 Vector type and distance metrics.
protocol_mapping.rs 876 Type mapping across wires.

(source: src/types/*.rs)

src/vector

File Lines Purpose
mod.rs 1757 Wire-neutral vector service reached with storage.vectors(). Collections and vectors persist under __vector__: keys; collections under 10,000 vectors are searched exactly; HNSW graphs are saved every 300 s.
sources.rs 1637 Cross-wire collections that index records written by other wires.
embed.rs 265 Text embedding providers. Compiled with rest-api.
score.rs 92 Converts canonical distance to each product's own score.
tests.rs 728 Unit tests.

(source: src/vector/*.rs)

Related pages