Skip to content

fix(mdbx): restore optional build - #113

Closed
LimiNode wants to merge 16 commits into
mainfrom
feat/mdbx-logger
Closed

fix(mdbx): restore optional build#113
LimiNode wants to merge 16 commits into
mainfrom
feat/mdbx-logger

Conversation

@LimiNode

@LimiNode LimiNode commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add public Logger backend accessors used by typed logger macros and the MDBX example
  • add mdbx-containers to_bytes/from_bytes support for MdbxLogger value types
  • add explicit C++17 guard and MDBX CI job

Verification

  • cmake -S . -B build-mdbx -G "MinGW Makefiles" -DLOGIT_CPP_BUILD_TESTS=ON -DLOGIT_CPP_BUILD_EXAMPLES=ON -DLOGIT_WITH_MDBX=ON -DLOGIT_USE_SUBMODULES=ON -DCMAKE_CXX_STANDARD=17
  • cmake --build build-mdbx
  • ctest --test-dir build-mdbx --output-on-failure -R mdbx_logger_test
  • cmake -S . -B build-default-check -G "MinGW Makefiles" -DLOGIT_CPP_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=17
  • cmake --build build-default-check
  • ctest --test-dir build-default-check --output-on-failure --quiet
  • cmake configure with LOGIT_WITH_MDBX=ON and CMAKE_CXX_STANDARD=11 fails clearly with the C++17 requirement
  • git diff --check

🤖 Generated with Claude Code

LimiNode and others added 16 commits May 30, 2026 20:02
Add MDBX-based logger using mdbx-containers submodule.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Extract detail::MdbxByteIO, detail::MdbxKeyUtils, detail::MdbxProcessId

- Make SessionV1, RecordV1, PayloadV1 private nested types of MdbxLogger

- Add external/kurlyk submodule

- Update read_range/read_session/read_payload to return view types

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…r callback

- Move compress/decompress helpers to detail/CompressionUtils.hpp shared by OTLP and MDBX

- OtlpCompression.hpp is now a backward-compat forwarding header

- MdbxLogger no longer depends on otlp/OtlpCompression.hpp

- Add MdbxLogger::read_payload_data() for transparent decompression

- Replace std::cerr with optional Config::on_error callback

- Fix CMake install guard: check mdbx_containers::mdbx_containers target

- Add overflow drop and on_error tests

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Shows macro logging via LOGIT_* macros

- Reads back session, records, spilled payloads via read_range/read_session/read_payload_data

- Demonstrates date-range query helper (YYYY-MM-DD -> ms)

- Includes level-based client-side filtering and statistics

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Replace flaky test_async_queue_overflow_drop with deterministic

  test_counters_zero_for_sync_writes and test_read_range_empty_and_limits

- Compute today midnight in example instead of hardcoded 2026-05-30

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…acros

- Introduce ILogReader.hpp with LogRecordView, LogReadOrder, ILogReader

- MdbxLogger inherits ILogReader; RecordView replaced by shared LogRecordView

- Add read_recent(limit, period_ms, order) returning ascending or descending records

- Add LOGIT_GET_LOGGER_AS and LOGIT_WITH_LOGGER_AS macros in log_macros.hpp

- Example updated to use LOGIT_WITH_LOGGER_AS instead of manual dynamic_cast

- Add read_recent tests and ILogReader usage in mdbx_logger_test.cpp

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…acros

- Introduce ILogReader.hpp with LogRecordView, LogReadOrder, ILogReader

- MdbxLogger inherits ILogReader; RecordView replaced by shared LogRecordView

- Add read_recent(limit, period_ms, order) returning ascending or descending records

- Add LOGIT_GET_LOGGER_AS and LOGIT_WITH_LOGGER_AS macros in log_macros.hpp

- Example updated to use LOGIT_WITH_LOGGER_AS instead of manual dynamic_cast

- Add read_recent tests and ILogReader usage in mdbx_logger_test.cpp

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… add MemoryLogger ILogReader

- Move ILogReader.hpp from logit/ to loggers/ILogReader.hpp (shared backend interface)

- Extract common std headers (atomic, cstddef, cstdint, deque, mutex, string, vector) into loggers.hpp umbrella

- Remove duplicate std includes from MdbxLogger.hpp and MemoryLogger.hpp

- MemoryLogger now inherits ILogReader and implements read_range + read_recent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add <algorithm> to loggers.hpp umbrella (fixes std::reverse in MemoryLogger)

- Bump time-shield-cpp submodule to main (d3c251b) fixing constexpr floor_mod warnings

- Bump CMake find_package(TimeShield) from 1.0.4 to 1.0.6

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change <logit/enums.hpp> to ../enums.hpp so CI with -I../../include resolves correctly

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- read_recent now reads full range then takes the last limit records

  instead of delegating limit to read_range which returns oldest first

- Test uses LOGIT_CURRENT_TIMESTAMP_MS() as now for period and limit checks

- Add limited_desc assertion to verify Descending with limit

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- LOGIT_GET_LOG_READER(index): retrieve ILogReader* from a logger by index

- LOGIT_WITH_LOG_READER(index, var): scoped if-block with ILogReader pointer

- LOGIT_READ_RANGE(index, from_ms, to_ms, limit): read time-window via ILogReader

- LOGIT_READ_RECENT(index, limit, period_ms, order): read recent via ILogReader

- LOGIT_READ_RECENT_ASC / DESC: shortcuts for LogReadOrder::Ascending / Descending

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add ILogSubscriber.hpp with add_log_callback / remove_log_callback

- MdbxLogger implements ILogSubscriber; callbacks invoked after commit without locks

- write_item_locked returns Record so write_batch can collect LogRecordView snapshots

- Add LOGIT_GET_LOG_SUBSCRIBER, LOGIT_WITH_LOG_SUBSCRIBER macros

- Add LOGIT_ADD_LOG_CALLBACK, LOGIT_REMOVE_LOG_CALLBACK macros

- Tests: sync callback, async callback, remove stops notifications, exception safety

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…acks

- add_log_callback / remove_log_callback now public so direct MdbxLogger calls compile

- notify_callbacks now reads m_callbacks.size() under m_callbacks_mutex

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Show add_log_callback, live events via LOGIT_INFO, LOGIT_WAIT

- Show remove_log_callback and verify no further updates

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
MDBX support was hidden behind an opt-in flag, so CI did not compile the backend test or the example path. The backend also relied on private Logger internals and lacked the value serialization contract required by mdbx-containers.

Constraint: keep vendored mdbx-containers unchanged
Directive: LOGIT_WITH_MDBX requires C++17 or newer
Confidence: high
Scope-risk: moderate

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LimiNode

LimiNode commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #114. The original branch included history already squashed into main, so the replacement PR was recreated from current origin/main with only the incremental MDBX optional-build fix.

@LimiNode LimiNode closed this Jun 1, 2026
@LimiNode
LimiNode deleted the feat/mdbx-logger branch June 3, 2026 00:04
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.

1 participant