feat: add common utilities including BinPacking, LinkedHashMap, LongCounter, Math, ScopeGuard, ThreadsafeQueue, and UUID - #5
Conversation
…ounter, Math, ScopeGuard, ThreadsafeQueue, and UUID
leaves12138
left a comment
There was a problem hiding this comment.
Thanks for migrating these common utility headers and tests. I compared the added files with the existing source snapshot; aside from the ASF header migration, the utility code itself matches the original implementation, and the lightweight header syntax check passes.
One blocker before merge: this PR adds math.h and uuid.h, which retain comments saying they are adapted from RocksDB / LevelDB, but the Apache repository's LICENSE and NOTICE files in this PR are not updated with the corresponding third-party attribution/license text. Please add the relevant RocksDB / LevelDB entries to LICENSE and NOTICE in the same PR that introduces these files.
The rest of the migration looks fine for this staged import.
9f92d1d to
c96672f
Compare
leaves12138
left a comment
There was a problem hiding this comment.
Thanks for the update. The RocksDB / LevelDB attribution has been added to LICENSE and NOTICE, and the migrated utility files still match the source snapshot aside from the expected ASF header normalization. LGTM.

Purpose
No Linked issue.
Introduce common utility modules to the apache/paimon-cpp codebase. These modules provide reusable data structures and helper functions that other components depend on.
BinPackingfor ordered bin packing of weighted items (bin_packing.h)LinkedHashMapproviding insertion-ordered key-value map (linked_hash_map.h)LongCounterfor simple int64 accumulation (long_counter.h)Mathutilities includingInRangeandEndianSwapValue(math.h)ScopeGuardfor RAII-style cleanup callbacks (scope_guard.h)ThreadsafeQueuefor thread-safe queue operations (threadsafe_queue.h)UUIDgenerator with cross-platform support for Linux and macOS (uuid.h)Tests
bin_packing_test.cpp— BinPacking ordered packing correctnesslinked_hash_map_test.cpp— LinkedHashMap insertion, lookup, deletion and iterationlong_counter_test.cpp— LongCounter add, merge and resetmath_test.cpp— InRange and EndianSwapValue correctnessscope_guard_test.cpp— ScopeGuard execution and releasethreadsafe_queue_test.cpp— ThreadsafeQueue push, pop and thread safetyuuid_test.cpp— UUID generation and format validationAPI and Format
Documentation
Generative AI tooling