{"id":22796038,"url":"https://github.com/krasun/lsmtree","last_synced_at":"2025-08-02T01:11:27.497Z","repository":{"id":57581040,"uuid":"360260185","full_name":"krasun/lsmtree","owner":"krasun","description":"Log-structured merge-tree","archived":false,"fork":false,"pushed_at":"2023-02-26T08:38:51.000Z","size":43,"stargazers_count":31,"open_issues_count":8,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-15T07:35:34.083Z","etag":null,"topics":["append","append-only","db","embedded-database","go","go-library","golang","lsm","lsm-tree"],"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-21T17:56:52.000Z","updated_at":"2025-07-05T00:14:49.000Z","dependencies_parsed_at":"2024-06-19T01:53:05.649Z","dependency_job_id":null,"html_url":"https://github.com/krasun/lsmtree","commit_stats":null,"previous_names":["krasun/appendy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/krasun/lsmtree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flsmtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flsmtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flsmtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flsmtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krasun","download_url":"https://codeload.github.com/krasun/lsmtree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flsmtree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268322418,"owners_count":24231819,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["append","append-only","db","embedded-database","go","go-library","golang","lsm","lsm-tree"],"created_at":"2024-12-12T05:09:49.644Z","updated_at":"2025-08-02T01:11:27.470Z","avatar_url":"https://github.com/krasun.png","language":"Go","readme":"# lsmtree\n\n[![Build](https://github.com/krasun/lsmtree/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/krasun/lsmtree/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/krasun/lsmtree/branch/main/graph/badge.svg?token=8NU6LR4FQD)](https://codecov.io/gh/krasun/lsmtree)\n[![Go Report Card](https://goreportcard.com/badge/github.com/krasun/lsmtree)](https://goreportcard.com/report/github.com/krasun/lsmtree)\n[![GoDoc](https://godoc.org/https://godoc.org/github.com/krasun/lsmtree?status.svg)](https://godoc.org/github.com/krasun/lsmtree)\n\nlsmtree is a log-structured merge-tree implementation in Go.\n\n**Attention!** lsmtree is **not** goroutine-safe - calling any methods on it from a different goroutine without synchronization is not safe and might lead to data corruption.  Make sure that the access is synchronized if the tree is used from the separate goroutines.\n\n## Installation\n\nAs simple as:\n\n```\ngo get github.com/krasun/lsmtree\n```\n\n## Quickstart\n\nA fully-featured example:\n\n```go\npackage lsmtree_test\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\n\t\"github.com/krasun/lsmtree\"\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\ttree, err := lsmtree.Open(dbDir, lsmtree.SparseKeyDistance(64), lsmtree.MemTableThreshold(1000000))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to open LSM tree %s: %w\", dbDir, err))\n\t}\n\n\terr = tree.Put([]byte(\"Hi!\"), []byte(\"Hello world, LSMTree!\"))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to put: %w\", err))\n\t}\n\n\terr = 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\terr = 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 = lsmtree.Open(dbDir)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to open LSM 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, LSMTree!\n\t// Yes, absolutely! The key has been overridden.\n}\n```\n\n## Tests \n\nTo make sure that the code is fully tested and covered:\n\n```\n$ go test .\nok  \tgithub.com/krasun/lsmtree\t2.888s\n```\n\n## Known Usages \n\n1. [krasun/gosqldb](https://github.com/krasun/gosqldb) - my experimental implementation of a simple database.\n\n## License \n\nlsmtree is released under [the MIT license](LICENSE).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasun%2Flsmtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrasun%2Flsmtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasun%2Flsmtree/lists"}