{"id":28184153,"url":"https://github.com/robur-coop/git-kv","last_synced_at":"2026-05-10T12:25:14.864Z","repository":{"id":62746518,"uuid":"560419264","full_name":"robur-coop/git-kv","owner":"robur-coop","description":"KV implementation on top of git (mirror of https://git.robur.coop/robur/git-kv)","archived":false,"fork":false,"pushed_at":"2025-03-10T09:53:01.000Z","size":111,"stargazers_count":12,"open_issues_count":5,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-12T05:58:23.974Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"OCaml","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/robur-coop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-11-01T13:13:39.000Z","updated_at":"2025-03-10T09:53:05.000Z","dependencies_parsed_at":"2024-04-30T16:45:10.105Z","dependency_job_id":"de0813f5-adbf-441c-91b8-ccec1bdf22af","html_url":"https://github.com/robur-coop/git-kv","commit_stats":null,"previous_names":["robur-coop/git-kv"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robur-coop%2Fgit-kv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robur-coop%2Fgit-kv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robur-coop%2Fgit-kv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robur-coop%2Fgit-kv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robur-coop","download_url":"https://codeload.github.com/robur-coop/git-kv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254470972,"owners_count":22076587,"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":[],"created_at":"2025-05-16T05:12:19.611Z","updated_at":"2026-05-10T12:25:14.800Z","avatar_url":"https://github.com/robur-coop.png","language":"OCaml","funding_links":[],"categories":["\u003ca name=\"OCaml\"\u003e\u003c/a\u003eOCaml"],"sub_categories":[],"readme":"# Git-kv, a simple Key-Value store synchronized with a Git repository\n\nThis library is a simple implementation of a Git repository that can be read\nand/or modified. It offers two ways to create such a local repository:\n1) The local repository can be created in a serialized state\n2) The local repository can be created from a remote repository\n\nThe first method has the advantage of not requiring an internet connection. The\nserialized state can be created with the `mgit` tool:\n```sh\n$ mgit https://github.com/mirage/mirage \u003c\u003cEOF\n\u003e save db.pack\n\u003e quit\n$ ls db.pack\ndb.pack\n```\n\nThe disadvantage is that the serialized state may be out of sync with the state\nof the remote repository. In this case, the user has access to the `pull`\nfunction, which allows the internet state of the local repository to be\nre-synchronised with the remote repository.\n```ocaml\nlet contents_of_file filename =\n  let ic = open_in filename in\n  let ln = in_channel_length ic in\n  let rs = Bytes.create ln in\n  really_input ic rs 0 ln ;\n  Bytes.unsafe_to_string rs\n\nlet _ =\n  Git_kv.of_octets ctx \n    ~remote:\"git@github.com:mirage/mirage.git\"\n    (contents_of_file \"db.pack\") \u003e\u003e= fun t -\u003e\n  Git_kv.pull t \u003e\u003e= fun diff -\u003e\n  ...\n```\n\nThe second method initiates a connection to the remote repository in order to\ndownload its state and reproduce a synchronised internal state. The type of\nconnections supported are described in the given `ctx`. We recommend the\ntutorial about [Mimic][mimic] to understand its use.\n```sh\nlet _ =\n  Git_kv.connect ctx \"git@github.com:mirage/mirage.git\" \u003e\u003e= fun t -\u003e\n  ...\n```\n\nThe user can manipulate the repository as an [RW][mirage-kv-rw] repository. Any\nchange to the repository requires a new commit. These changes will be sent to\nthe remote repository. The user can _fold_ any changes into one commit if\nhe/she wants.\n```ocaml\nlet new_file t =\n  Git_kv.set t Mirage_kv.Key.(empty / \"foo\") \"foo\" \u003e\u003e= fun () -\u003e\n  (* XXX(dinosaure): a commit was created and sended to the\n     remote repository. *)\n  ...\n\nlet new_files t =\n  Git_kv.change_and_push t @@ fun t -\u003e\n  Git_kv.set t Mirage_kv.Key.(empty / \"foo\" \"foo\") \u003e\u003e= fun () -\u003e\n  Git_kv.set t Mirage_kv.Key.(empty / \"bar\" \"bar\")\n(* XXX(dinosaure): multiple files are added into the local repository\n   but they are committed only at the end of the given function\n   to [change_and_push]. That's say, only one commit was made and sended to the\n   remote Git repository. *)\n```\n\n[mimic]: https://dinosaure.github.io/mimic/mimic/index.html\n[mirage-kv-rw]: https://github.com/mirage/mirage-kv\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobur-coop%2Fgit-kv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobur-coop%2Fgit-kv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobur-coop%2Fgit-kv/lists"}