{"id":26943869,"url":"https://github.com/aixiasang/bitcask","last_synced_at":"2026-04-27T22:32:33.987Z","repository":{"id":283665740,"uuid":"952294062","full_name":"aixiasang/bitcask","owner":"aixiasang","description":"一个基于Bitcask论文实现的高性能键值存储系统，具有简单、高效、持久化和崩溃恢复的特性。🚀 高性能读写操作：写入复杂度O(1)，读取复杂度O(1) 💾 数据持久化：所有操作都会被记录到WAL文件 🛡️ 崩溃恢复：通过hint文件和WAL文件确保数据不丢失 🔄 自动文件轮转：防止单个数据文件过大 🔒 并发安全：支持多线程并发访问 🧹 数据合并：支持清理过期数据，优化存储空间","archived":false,"fork":false,"pushed_at":"2025-03-29T12:11:10.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T13:23:05.617Z","etag":null,"topics":["bitcask","database","nosql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aixiasang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-03-21T03:38:24.000Z","updated_at":"2025-03-29T12:11:13.000Z","dependencies_parsed_at":"2025-03-21T13:39:33.574Z","dependency_job_id":null,"html_url":"https://github.com/aixiasang/bitcask","commit_stats":null,"previous_names":["aixiasang/bitcask"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aixiasang%2Fbitcask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aixiasang%2Fbitcask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aixiasang%2Fbitcask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aixiasang%2Fbitcask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aixiasang","download_url":"https://codeload.github.com/aixiasang/bitcask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246856600,"owners_count":20844974,"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":["bitcask","database","nosql"],"created_at":"2025-04-02T17:17:47.025Z","updated_at":"2026-04-27T22:32:33.981Z","avatar_url":"https://github.com/aixiasang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitcask\n\nA high-performance key-value storage engine based on the [Bitcask](https://riak.com/assets/bitcask-intro.pdf) paper, written in Go.\n\nBitcask uses a log-structured storage model:\n\n- **Write**: Append-only writes to the active data file, one sequential disk IO\n- **Read**: In-memory index maps keys to file positions, one random disk IO\n- **Merge**: Background compaction reclaims space from deleted/overwritten entries\n\n## Features\n\n**Core**\n- High-performance read/write with O(1) complexity\n- Multiple index types: B-tree / Skip List\n- Atomic batch writes with WriteBatch\n- CRC32 checksum for data integrity\n- Configurable merge/compaction strategies\n\n**Protocol**\n- HTTP RESTful API\n- Redis RESP protocol (compatible with redis-cli)\n- Redis data structures: String / Hash / List / Set / ZSet\n\n**Optimization**\n- LRU cache for hot data\n- Bloom filter to reduce disk IO\n- TTL support with background cleanup\n- Memory-mapped file IO (MMap)\n\n## Quick Start\n\n```go\nopts := bitcask.DefaultOptions\nopts.DirPath = \"/tmp/bitcask\"\n\ndb, _ := bitcask.Open(opts)\ndefer db.Close()\n\n// Basic operations\ndb.Put([]byte(\"name\"), []byte(\"bitcask\"))\nval, _ := db.Get([]byte(\"name\"))\ndb.Delete([]byte(\"name\"))\n\n// Batch operations\nwb := db.NewWriteBatch(bitcask.DefaultWriteBatchOptions)\nwb.Put([]byte(\"k1\"), []byte(\"v1\"))\nwb.Put([]byte(\"k2\"), []byte(\"v2\"))\nwb.Commit()\n\n// Iterator\niter := db.NewIterator(bitcask.DefaultIteratorOptions)\nfor iter.Rewind(); iter.Valid(); iter.Next() {\n    fmt.Printf(\"%s = %s\\n\", iter.Key(), iter.Value())\n}\niter.Close()\n```\n\n## HTTP Server\n\n```bash\n# Start server\ngo run ./cmd/bitcask-server -dir ./data -http :8080\n\n# Usage\ncurl -X PUT localhost:8080/api/v1/kv/name -d '{\"value\":\"bitcask\"}'\ncurl localhost:8080/api/v1/kv/name\ncurl -X DELETE localhost:8080/api/v1/kv/name\n```\n\n## Redis Server\n\n```bash\n# Start server\ngo run ./cmd/redis-server -dir ./data -addr :6379\n\n# Use redis-cli\nredis-cli -p 6379\n\u003e SET name bitcask\n\u003e GET name\n\u003e HSET user:1 name alice age 30\n\u003e LPUSH queue task1 task2\n\u003e ZADD scores 100 alice 90 bob\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faixiasang%2Fbitcask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faixiasang%2Fbitcask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faixiasang%2Fbitcask/lists"}