{"id":20345448,"url":"https://github.com/naqvijafar91/cutedb","last_synced_at":"2025-04-12T00:40:46.999Z","repository":{"id":34063071,"uuid":"165960557","full_name":"naqvijafar91/cuteDB","owner":"naqvijafar91","description":"A slick BTree on disk based key value store implemented in pure Go","archived":false,"fork":false,"pushed_at":"2022-06-26T22:31:19.000Z","size":727,"stargazers_count":145,"open_issues_count":5,"forks_count":26,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-25T20:21:47.561Z","etag":null,"topics":["database","embedded-database","go","golang","key-value","key-value-database","key-value-pair","key-value-store"],"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/naqvijafar91.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}},"created_at":"2019-01-16T02:37:59.000Z","updated_at":"2025-02-19T03:28:45.000Z","dependencies_parsed_at":"2022-08-31T04:20:46.065Z","dependency_job_id":null,"html_url":"https://github.com/naqvijafar91/cuteDB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvijafar91%2FcuteDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvijafar91%2FcuteDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvijafar91%2FcuteDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvijafar91%2FcuteDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naqvijafar91","download_url":"https://codeload.github.com/naqvijafar91/cuteDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501960,"owners_count":21114681,"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":["database","embedded-database","go","golang","key-value","key-value-database","key-value-pair","key-value-store"],"created_at":"2024-11-14T22:08:32.809Z","updated_at":"2025-04-12T00:40:46.976Z","avatar_url":"https://github.com/naqvijafar91.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cuteDB\n\nThe purpose of this project is to understand how a production ready key value store works. \n\n### Contributions\n\nAll contributors are welcome, lets spread and grow the knowledge about databases by building them.\n\nSteps to Run\n\n```\nmkdir db\ngo test\n```\nIt can be used as a library in any go project. \n\n## BTree\nIn computer science, a B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children.[1] Unlike self-balancing binary search trees, the B-tree is well suited for storage systems that read and write relatively large blocks of data, such as discs. It is commonly used in databases and file systems.\n\n\n### Insertions and deletions\nIf the database does not change, then compiling the index is simple to do, and the index need never be changed. If there are changes, then managing the database and its index becomes more complicated.\n\nDeleting records from a database is relatively easy. The index can stay the same, and the record can just be marked as deleted. The database remains in sorted order. If there are a large number of deletions, then searching and storage become less efficient.\n\nInsertions can be very slow in a sorted sequential file because room for the inserted record must be made. Inserting a record before the first record requires shifting all of the records down one. Such an operation is just too expensive to be practical. One solution is to leave some spaces. Instead of densely packing all the records in a block, the block can have some free space to allow for subsequent insertions. Those spaces would be marked as if they were \"deleted\" records.\n\nBoth insertions and deletions are fast as long as space is available on a block. If an insertion won't fit on the block, then some free space on some nearby block must be found and the auxiliary indices adjusted. The hope is that enough space is available nearby, such that a lot of blocks do not need to be reorganized. Alternatively, some out-of-sequence disk blocks may be used.\n\n### Advantages of B-tree usage for databases\nThe B-tree uses all of the ideas described above. In particular, a B-tree:\n\n* keeps keys in sorted order for sequential traversing\n* uses a hierarchical index to minimize the number of disk reads\n* uses partially full blocks to speed insertions and deletions\n* keeps the index balanced with a recursive algorithm\n* In addition, a B-tree minimizes waste by making sure the interior nodes are at least half full. A B-tree can handle an arbitrary number of insertions and deletions.\n\n### Limitations of cuteDB\n\n* Currently it can only be used via a single goroutine\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaqvijafar91%2Fcutedb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaqvijafar91%2Fcutedb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaqvijafar91%2Fcutedb/lists"}