Skip to content

Add AtomDB::composite_type_enabled()#1180

Closed
ccgsnet wants to merge 2 commits into
masterfrom
composite-type-enabled
Closed

Add AtomDB::composite_type_enabled()#1180
ccgsnet wants to merge 2 commits into
masterfrom
composite-type-enabled

Conversation

@ccgsnet

@ccgsnet ccgsnet commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add composite_type_enabled (default true) to AtomDB config and expose it via AtomDB::composite_type_enabled().
  • When disabled, RedisMongoDB/MorkDB skip composite-type map/hash logic on add and omit composite_type / composite_type_hash from link documents.
  • Wire the flag through AdapterDB, RemoteAtomDBPeer, and InMemoryDB; cover with unit tests and config fixtures.

Test plan

  • bazel test //tests/cpp:redis_mongodb_test --test_filter=RedisMongoDBTest.CompositeTypeEnabledFlag
  • bazel test //tests/cpp:config_parser_test --test_filter=ConfigParserTest.GetNestedStructure

@ccgsnet ccgsnet self-assigned this Jul 17, 2026
@ccgsnet ccgsnet closed this Jul 17, 2026
@ccgsnet
ccgsnet deleted the composite-type-enabled branch July 17, 2026 13:34
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d85dec7b-8e5c-4218-bc4f-84a3e403568f

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2713a and a941738.

📒 Files selected for processing (19)
  • config/das.json
  • src/atomdb/AtomDB.h
  • src/atomdb/adapterdb/AdapterDB.cc
  • src/atomdb/adapterdb/AdapterDB.h
  • src/atomdb/inmemorydb/InMemoryDB.h
  • src/atomdb/morkdb/MorkDB.cc
  • src/atomdb/redis_mongodb/RedisMongoDB.cc
  • src/atomdb/redis_mongodb/RedisMongoDB.h
  • src/atomdb/redis_mongodb/RedisMongoDBAPITypes.cc
  • src/atomdb/redis_mongodb/RedisMongoDBAPITypes.h
  • src/atomdb/remotedb/RemoteAtomDB.cc
  • src/atomdb/remotedb/RemoteAtomDB.h
  • src/atomdb/remotedb/RemoteAtomDBPeer.cc
  • src/atomdb/remotedb/RemoteAtomDBPeer.h
  • src/tests/assets/adapterdb_config.json
  • src/tests/assets/remotedb_config_single.json
  • src/tests/cpp/config_parser_test.cc
  • src/tests/cpp/redis_mongodb_test.cc
  • src/tests/cpp/test_commons/TestAtomDBJsonConfig.h

  • Adds the composite_type_enabled configuration flag, enabled by default, and exposes it through the AtomDB interface and implementations (AdapterDB, RedisMongoDB, RemoteAtomDBPeer, InMemoryDB, and RemoteAtomDB).
  • Gates composite-type bookkeeping and MongoDB link-document fields on the flag; disabled writes omit composite_type and composite_type_hash, reducing composite metadata work and allocations on those paths.
  • Updates production and test configuration fixtures, plus unit coverage for default, explicitly disabled, and transactional RedisMongoDB behavior and config parsing.
  • Code-quality risk: the RemoteAtomDB implementation raises an error but then returns true, and the new pure virtual API requires every backend implementation to remain synchronized. No specific thread-safety changes are evident; shared composite maps retain their existing synchronization assumptions.

Walkthrough

Adds a composite_type_enabled() capability across AtomDB implementations, gates composite metadata during RedisMongoDB and MorkDB writes, updates BSON document construction, and adds configuration fixtures and tests for enabled, default, disabled, and transactional paths.

Changes

Composite type capability

Layer / File(s) Summary
Capability contract and adapters
src/atomdb/AtomDB.h, src/atomdb/adapterdb/*, src/atomdb/inmemorydb/InMemoryDB.h, src/atomdb/remotedb/*
Adds the capability query to the AtomDB interface and implementations, delegates through AdapterDB and remote peers, and reports disabled support for InMemoryDB.
Conditional link document fields
src/atomdb/redis_mongodb/RedisMongoDBAPITypes.*
Adds an include_composite_type constructor flag and conditionally writes composite-type BSON fields.
Backend write-path gating
src/atomdb/redis_mongodb/RedisMongoDB.*, src/atomdb/morkdb/MorkDB.cc
Reads the configuration flag and gates composite metadata creation, copying, and cleanup across node and link write paths.
Configuration defaults and validation
config/das.json, src/tests/assets/*, src/tests/cpp/*
Adds enabled configuration values, validates parsing, and tests enabled, default, disabled, and transactional persistence behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant JsonConfig
  participant RedisMongoDB
  participant MongodbDocument
  participant MongoDB
  JsonConfig->>RedisMongoDB: Read composite_type_enabled
  RedisMongoDB->>MongodbDocument: Build link document with or without composite fields
  MongodbDocument->>MongoDB: Store BSON document
Loading

Suggested reviewers: marcocapozzoli

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch composite-type-enabled

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants