{"id":34066628,"url":"https://github.com/lyramilk/cavedb","last_synced_at":"2026-04-05T18:32:08.240Z","repository":{"id":46101329,"uuid":"107102383","full_name":"lyramilk/cavedb","owner":"lyramilk","description":"用leveldb包装的仿redis进程内数据库，仅在有实际需要的时候添加命令进去。","archived":false,"fork":false,"pushed_at":"2024-06-28T07:40:17.000Z","size":3583,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-13T00:17:04.173Z","etag":null,"topics":["nosql","redis","ssdb"],"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/lyramilk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-16T08:52:30.000Z","updated_at":"2024-10-23T03:43:51.000Z","dependencies_parsed_at":"2023-12-21T11:48:15.533Z","dependency_job_id":"c3f426d0-81c5-411b-bd79-1bd0ff98b185","html_url":"https://github.com/lyramilk/cavedb","commit_stats":{"total_commits":70,"total_committers":3,"mean_commits":"23.333333333333332","dds":"0.24285714285714288","last_synced_commit":"36e643c9b113cb7f6ddd750853a162c5a1ab38ef"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lyramilk/cavedb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyramilk%2Fcavedb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyramilk%2Fcavedb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyramilk%2Fcavedb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyramilk%2Fcavedb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyramilk","download_url":"https://codeload.github.com/lyramilk/cavedb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyramilk%2Fcavedb/sbom","scorecard":{"id":607508,"data":{"date":"2025-08-11","repo":{"name":"github.com/lyramilk/cavedb","commit":"60ecb918f181d2158a3b2201e660dedd1c1676dc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T01:56:02.955Z","repository_id":46101329,"created_at":"2025-08-21T01:56:02.955Z","updated_at":"2025-08-21T01:56:02.955Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31446523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T15:22:31.103Z","status":"ssl_error","status_checked_at":"2026-04-05T15:22:00.205Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["nosql","redis","ssdb"],"created_at":"2025-12-14T06:43:55.569Z","updated_at":"2026-04-05T18:32:08.235Z","avatar_url":"https://github.com/lyramilk.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cavedb\n\n## 编译方法\n```\ngit clone --recurse-submodules  https://github.com/lyramilk/cavedb.git\nmkdir build_cavedb\ncd build_cavedb\ncmake ../cavedb/cavedb\nmake -j \n```\n\n这是一个实现了ssdb和redis同步协议的同步工具，它可以从ssdb或redis同步数据。\n目前同步redis还有bug，从比较大的redis同步的时候会出现被主库中断连接的情况，所以实际使用中以ssdb为主。\n同步不支持redis的list和ssdb的queue容器。遇到操作这个容器的命令请忽略。\n\n## 第一版本 完整实现redis语义\n如有需要可以翻看git提交的历史记录。第一版本中实现了比较完整的语义支持redis但性能不佳，其中包括zset通过double类型分数排序而重写了leveldb的数据比较对象。\n\n\n## 第二版本 简洁，实用\n整体结构有三大部分:\n1.同步工具slave_ssdb和slave_redis用于走主从同步协议从ssdb或redis拉取数据\n2.数据接收工具store，从slave_xxxx中同步来的数据会回调store存储工具，实现了这个接口就可以拿到数据了，需要注意的是同步线程是单线程的。\n3.一系列包含存储功能的store的实现，随库自带的几个store走极简风格，只响应了ssdb的hashmap容器。并且在读的时候只支持hexist、hget、hgetall这三个功能。\n\n## 第三个版本 独立\n因为redis主从同步需要先处理一个可能很巨大的rdb，体验并不好，所以在第三个版本去掉了对redis主从同步的支持，增加了自己的binlog和主从同步。用一个非常简单并且完全兼容redis协议的命令来实现。在这一版本里，cavedb可以不借助ssdb或redis独立工作了。其主从同步命令可以用几乎任何现有的redis客户端调用，通过类似scan的形式完全、持续地获取数据。因主从同步命令的无会话特性，主从同步的速度比较第二版降低了一些，但客户端实现起来变得非常简单，实用性大大提高。\n### cavedb主从同步命令\n\n#### cavedb_sync\n##### 命令格式\n```cavedb_sync [key] [seq] [count]```\n##### 详解\n这个命令在从库端调用，每次执行查询主库的一部分数据。\n根据key和seq，按顺序扫描全量数据。每次获取seq序列号代表的binlog进度到最新的数据。返回的时候返回一个三项的数组，数组第1项(index=0)是下一次的key，数组第2项是下一次的seq，数组第3项是个子数组，保存读取到的数据，最多count条记录。\n\n主不保存每个从的状态，同步过程中是无会话的。\n从库每次调用同步命令查询主库一段数据。\n\n# 编译方法\n依赖libmilk-devel这是我的另外一个工程\n\n    cmake3 [cavedb目录]\n    make\n\n# 打包rpm方法，需要rpmbuild\n\n    cmake3 [cavedb目录]\n    cd [cavedb目录]/pkg\n    rpmbuild -bb cavedb.spec\n\n# pycavedb示例\n创建对象继承于cavedb.cavedb。调用其 slaveof_redis/slaveof_ssdb方法，从redis/ssdb同步数据，其中last_replid和last_offset表示同步进度，从覆盖的notify_psync/notify_command/notify_idle方法中可以获取同步进度\n\n    #! /usr/bin/python\n    #coding:utf-8\n    \n    \n    import cavedb\n    import time\n    \n    \n    times = 0;\n    \n    class cavedb_impl(cavedb.cavedb):\n    \tdef notify_command(self,replid,offset,args):\n    \t\tglobal times\n    \t\tprint args\n    \t\treturn True;\n    \n    cavedb_instance = cavedb_impl();\n    \n    \n    last_offset = 0;\n    last_replid = \"\";\n    \n    cavedb_instance.slaveof_redis(\"127.0.0.1\",6379,\"\",last_replid,last_offset);\n    \n    \n    while True:\n    \ttime.sleep(1);\n    \tprint(\"cavedb speed %u/sec\"%times);\n    \ttimes = 0;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyramilk%2Fcavedb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyramilk%2Fcavedb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyramilk%2Fcavedb/lists"}