# levin **Repository Path**: didiopensource/levin ## Basic Information - **Project Name**: levin - **Description**: A Quick Way to Bulk Loading - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-08-12 - **Last Updated**: 2026-02-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Levin - A Quick Way to Bulk Loading ======================= Description ------- Levin provides a highly efficient solution in bulk loading scenario. A collection of STL-like containers are implemented with high performance and memory efficiency. Levin containers arrange memory layout SEQUENTIALLY, allocated at share memory region for inter-process reuse. In which case, we can extend the lifetime of data resources, and prevent unnecessary time-consuming reload. Loading with levin is fast, let's get started. Getting Started ------- * Brief Intro for Levin Container | STD Container | Levin Container | Notes | Suggestion | | --------------------------------- | ------------------------------ | --------------- | ------------------------------------- | | vector\ | SharedVector\ | T is POD type | | | set\ | SharedSet\ | K is POD type | use SharedHashSet if no comparison | | map\ | SharedMap\ | K/V is POD type | use SharedHashMap if no comparison | | unordered_set\ | SharedHashSet\ | K is POD type | | | unordered_map\ | SharedHashMap\ | K/V is POD type | | | vector\ \> | SharedNestedVector\ | T is POD type; SizeType is unsigned integral type | specified SizeType for memory space efficiency | | unordered_map\ \> | SharedNestedHashMap\ | K/V is POD type | | | vector\ \> | SharedNestedMap\ | K/V is POD type; SizeType is unsigned integral type | | * How to Dump Container Data to A File ```c++ // vector dump demo std::vector vec_data = {1, 2, 3, 4, 5}; levin::SharedVector::Dump("./vec_demo.dat", vec_data); ``` ```c++ // map/hashmap dump demo std::unordered_map map_data = { {1, 100}, {2, 200}, {3, 300} }; // or std::map map_data = { {1, 100}, {2, 200}, {3, 300} }; levin::SharedHashMap::Dump("./map_demo.dat", map_data); ``` * How to Use Container Tips: Levin container SHOULD be immutable, NOT suggest to modify or reallocate. ```c++ // shared vector use demo levin::SharedVector vec("./vec_demo.dat"); if (vec.Init() == levin::SC_RET_OK && vec.Load() == levin::SC_RET_OK) { ... } vec.Destroy(); ``` ```c++ // shared hashmap use demo auto map_ptr = new levin::SharedHashMap("./map_demo.dat"); if (map_ptr->Init() == levin::SC_RET_OK && map_ptr->Load() == levin::SC_RET_OK) { ... } map_ptr->Destroy(); delete map_ptr; ``` * How to Manage a set of Containers [example code](example/shared_manager_demo.cpp) of container manager usage Dependencies ------- Levin depends on following packages, required deps: * gcc >= 4.8.5 * cmake >= 2.6.0 * boost >= 1.56.0 * openssl * gtest Compile ------- * create directory build, cd build * compile: cmake .. && make Documentation ------- About the details, please see [Wiki](../../wiki). Contributing ------- Welcome to contribute by creating issues or sending pull requests. See [Contributing Guide](CONTRIBUTING.md) for guidelines. Communication ------- ![QQ](images/QQ.JPG) License ------- Levin is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file.