{"id":13713363,"url":"https://github.com/krasun/fbptree","last_synced_at":"2025-08-13T06:07:00.335Z","repository":{"id":49829736,"uuid":"389085732","full_name":"krasun/fbptree","owner":"krasun","description":"A persistent storage (in file) based using B+ tree with byte-slice keys and values","archived":false,"fork":false,"pushed_at":"2022-01-09T12:31:21.000Z","size":95,"stargazers_count":26,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T11:23:29.431Z","etag":null,"topics":["bplus-tree","bplustree","bptree","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krasun.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}},"created_at":"2021-07-24T11:51:19.000Z","updated_at":"2025-03-14T20:26:17.000Z","dependencies_parsed_at":"2022-07-30T16:39:10.583Z","dependency_job_id":null,"html_url":"https://github.com/krasun/fbptree","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/krasun%2Ffbptree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Ffbptree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Ffbptree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Ffbptree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krasun","download_url":"https://codeload.github.com/krasun/fbptree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249698516,"owners_count":21312212,"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":["bplus-tree","bplustree","bptree","go","golang"],"created_at":"2024-08-02T23:01:33.880Z","updated_at":"2025-04-19T12:47:46.954Z","avatar_url":"https://github.com/krasun.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# **fbp**tree\n\n[![Build](https://github.com/krasun/fbptree/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/krasun/fbptree/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/krasun/fbptree/branch/main/graph/badge.svg?token=8NU6LR4FQD)](https://codecov.io/gh/krasun/fbptree)\n[![Go Report Card](https://goreportcard.com/badge/github.com/krasun/fbptree)](https://goreportcard.com/report/github.com/krasun/fbptree)\n[![GoDoc](https://godoc.org/https://godoc.org/github.com/krasun/fbptree?status.svg)](https://godoc.org/github.com/krasun/fbptree)\n\n`fbptree` is a persistent key-value storage engine based on [B+ tree](https://en.wikipedia.org/wiki/B%2B_tree) with byte-slice keys and values. \n\n## Installation \n\nTo install, run:\n\n```\ngo get github.com/krasun/fbptree\n```\n\n## Usage\n\nAn example of usage: \n\n```go\npackage fbptree_test\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path\"\n\n\t\"github.com/krasun/fbptree\"\n)\n\nfunc Example() {\n\tdbDir, err := ioutil.TempDir(os.TempDir(), \"example\")\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to create %s: %w\", dbDir, err))\n\t}\n\tdefer func() {\n\t\tif err := os.RemoveAll(dbDir); err != nil {\n\t\t\tpanic(fmt.Errorf(\"failed to remove %s: %w\", dbDir, err))\n\t\t}\n\t}()\n\n\tdbPath := path.Join(dbDir, \"sample.data\")\n\n\ttree, err := fbptree.Open(dbPath, fbptree.PageSize(4096), fbptree.Order(500))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to open B+ tree %s: %w\", dbDir, err))\n\t}\n\n\t_, _, err = tree.Put([]byte(\"Hi!\"), []byte(\"Hello world, B+ tree!\"))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to put: %w\", err))\n\t}\n\n\t_, _, err = tree.Put([]byte(\"Does it override key?\"), []byte(\"No!\"))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to put: %w\", err))\n\t}\n\n\t_, _, err = tree.Put([]byte(\"Does it override key?\"), []byte(\"Yes, absolutely! The key has been overridden.\"))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to put: %w\", err))\n\t}\n\n\tif err := tree.Close(); err != nil {\n\t\tpanic(fmt.Errorf(\"failed to close: %w\", err))\n\t}\n\n\ttree, err = fbptree.Open(dbPath, fbptree.PageSize(4096), fbptree.Order(500))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to open B+ tree %s: %w\", dbDir, err))\n\t}\n\n\tvalue, ok, err := tree.Get([]byte(\"Hi!\"))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to get value: %w\", err))\n\t}\n\tif !ok {\n\t\tfmt.Println(\"failed to find value\")\n\t}\n\n\tfmt.Println(string(value))\n\n\tvalue, ok, err = tree.Get([]byte(\"Does it override key?\"))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to get value: %w\", err))\n\t}\n\tif !ok {\n\t\tfmt.Println(\"failed to find value\")\n\t}\n\n\tif err := tree.Close(); err != nil {\n\t\tpanic(fmt.Errorf(\"failed to close: %w\", err))\n\t}\n\n\tfmt.Println(string(value))\n\t// Output:\n\t// Hello world, B+ tree!\n\t// Yes, absolutely! The key has been overridden.\n}\n```\n\n## Tests\n\nRun tests with: \n\n```\n$ go test .\nok  \tgithub.com/krasun/fbptree\t0.679s\n```\n\n## License \n\n**fbp**tree is released under [the MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasun%2Ffbptree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrasun%2Ffbptree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasun%2Ffbptree/lists"}