Skip to content

feat(mdbx): add MdbxLogger#112

Merged
NewYaroslav merged 15 commits into
mainfrom
feat/mdbx-logger
May 30, 2026
Merged

feat(mdbx): add MdbxLogger#112
NewYaroslav merged 15 commits into
mainfrom
feat/mdbx-logger

Conversation

@NewYaroslav
Copy link
Copy Markdown
Owner

Add MDBX-based logger using mdbx-containers submodule.

NewYaroslav and others added 15 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>
@NewYaroslav NewYaroslav merged commit 6061adb into main May 30, 2026
12 checks passed
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