{"id":28729786,"url":"https://github.com/didi/levin","last_synced_at":"2025-06-15T17:11:02.788Z","repository":{"id":50890892,"uuid":"194588319","full_name":"didi/levin","owner":"didi","description":"A Quick Way to Bulk Loading","archived":false,"fork":false,"pushed_at":"2021-05-28T03:23:15.000Z","size":490,"stargazers_count":105,"open_issues_count":0,"forks_count":26,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-14T13:44:08.438Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/didi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-01T02:44:25.000Z","updated_at":"2024-01-26T11:06:44.000Z","dependencies_parsed_at":"2022-08-25T15:50:36.290Z","dependency_job_id":null,"html_url":"https://github.com/didi/levin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/didi/levin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Flevin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Flevin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Flevin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Flevin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/didi","download_url":"https://codeload.github.com/didi/levin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/didi%2Flevin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260016055,"owners_count":22946321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-15T17:11:01.548Z","updated_at":"2025-06-15T17:11:02.779Z","avatar_url":"https://github.com/didi.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Levin - A Quick Way to Bulk Loading\n=======================\n\n\nDescription\n-------\n\nLevin provides a highly efficient solution in bulk loading scenario.\nA collection of STL-like containers are implemented with high performance and memory efficiency.\nLevin containers arrange memory layout SEQUENTIALLY, allocated at share memory region for inter-process reuse.\nIn which case, we can extend the lifetime of data resources, and prevent unnecessary time-consuming reload.\n\nLoading with levin is fast, let's get started.\n\n\nGetting Started\n-------\n\n* Brief Intro for Levin Container\n\n|          STD Container            |       Levin Container          |      Notes      |               Suggestion              |\n| --------------------------------- | ------------------------------ | --------------- | ------------------------------------- |\n| vector\\\u003cT\\\u003e                       | SharedVector\\\u003cT\\\u003e              | T is POD type   |                                       |\n| set\\\u003cK, Compare\\\u003e                 | SharedSet\\\u003cK, Compare\\\u003e        | K is POD type   | use SharedHashSet if no comparison    |\n| map\\\u003cK, V, Compare\\\u003e              | SharedMap\\\u003cK, V, Compare\\\u003e     | K/V is POD type | use SharedHashMap if no comparison    |\n| unordered_set\\\u003cK, Hash, Pred\\\u003e    | SharedHashSet\\\u003cK, Hash, Pred\\\u003e | K is POD type   |                                       |\n| unordered_map\\\u003cK, V, Hash, Pred\\\u003e | SharedHashMap\\\u003cK, V, Hash\\\u003e    | K/V is POD type |                                       |\n| vector\\\u003cvector\\\u003cT\\\u003e \\\u003e            | SharedNestedVector\\\u003cT, SizeType\\\u003e | T is POD type; SizeType is unsigned integral type | specified SizeType for memory space efficiency |\n| unordered_map\\\u003cK, vector\\\u003cV\\\u003e \\\u003e  | SharedNestedHashMap\\\u003cK, V\\\u003e    | K/V is POD type |                                       |\n| vector\\\u003cmap\\\u003cK, V, Compare\\\u003e \\\u003e   | SharedNestedMap\\\u003cK, V, Compare, SizeType\\\u003e | K/V is POD type; SizeType is unsigned integral type |   |\n\n\n* How to Dump Container Data to A File\n\n```c++\n// vector dump demo\nstd::vector\u003cint\u003e vec_data = {1, 2, 3, 4, 5};\nlevin::SharedVector\u003cint\u003e::Dump(\"./vec_demo.dat\", vec_data);\n```\n\n```c++\n// map/hashmap dump demo\nstd::unordered_map\u003cint64_t, int32_t\u003e map_data = { {1, 100}, {2, 200}, {3, 300} };\n// or std::map\u003cint64_t, int32_t\u003e map_data = { {1, 100}, {2, 200}, {3, 300} };\nlevin::SharedHashMap\u003cint64_t, int32_t\u003e::Dump(\"./map_demo.dat\", map_data);\n```\n\n\n* How to Use Container\n\nTips: Levin container SHOULD be immutable, NOT suggest to modify or reallocate.\n\n```c++\n// shared vector use demo\nlevin::SharedVector\u003cint\u003e vec(\"./vec_demo.dat\");\nif (vec.Init() == levin::SC_RET_OK \u0026\u0026 vec.Load() == levin::SC_RET_OK) {\n    ...\n}\nvec.Destroy();\n```\n\n```c++\n// shared hashmap use demo\nauto map_ptr = new levin::SharedHashMap\u003cint64_t, int32_t\u003e(\"./map_demo.dat\");\nif (map_ptr-\u003eInit() == levin::SC_RET_OK \u0026\u0026 map_ptr-\u003eLoad() == levin::SC_RET_OK) {\n    ...\n}\nmap_ptr-\u003eDestroy();\ndelete map_ptr;\n```\n\n\n* How to Manage a set of Containers\n\n[example code](example/shared_manager_demo.cpp) of container manager usage\n\n\nDependencies\n-------\n\nLevin depends on following packages, required deps:\n\n* gcc \u003e= 4.8.5\n* cmake \u003e= 2.6.0\n* boost \u003e= 1.56.0\n* openssl\n* gtest\n\nCompile\n-------\n\n* create directory build, cd build\n* compile: cmake .. \u0026\u0026 make\n\nDocumentation\n-------\n\nAbout the details, please see [Wiki](../../wiki).\n\nContributing\n-------\n\nWelcome to contribute by creating issues or sending pull requests. See [Contributing Guide](CONTRIBUTING.md) for guidelines.\n\nCommunication\n-------\n\n![QQ](images/QQ.JPG)\n\nLicense\n-------\n\nLevin is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdidi%2Flevin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdidi%2Flevin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdidi%2Flevin/lists"}