{"id":13879501,"url":"https://github.com/ioquatix/relaxo","last_synced_at":"2025-05-15T21:04:05.458Z","repository":{"id":3896313,"uuid":"4984118","full_name":"ioquatix/relaxo","owner":"ioquatix","description":"Relaxo is a transactional document database built on top of git.","archived":false,"fork":false,"pushed_at":"2025-01-12T00:18:45.000Z","size":180,"stargazers_count":181,"open_issues_count":0,"forks_count":6,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-14T03:15:50.987Z","etag":null,"topics":["database","document-storage","git","relaxo","ruby","transactional"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ioquatix.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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},"funding":{"github":"ioquatix"}},"created_at":"2012-07-11T03:50:06.000Z","updated_at":"2025-03-26T00:30:16.000Z","dependencies_parsed_at":"2024-06-21T14:07:14.596Z","dependency_job_id":"4022700f-5765-4064-9687-df78315a222d","html_url":"https://github.com/ioquatix/relaxo","commit_stats":{"total_commits":142,"total_committers":3,"mean_commits":"47.333333333333336","dds":"0.021126760563380254","last_synced_commit":"c790600f32c9015473c431c18ccab929f6e3857c"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ioquatix","download_url":"https://codeload.github.com/ioquatix/relaxo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254422754,"owners_count":22068678,"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","document-storage","git","relaxo","ruby","transactional"],"created_at":"2024-08-06T08:02:23.054Z","updated_at":"2025-05-15T21:04:05.435Z","avatar_url":"https://github.com/ioquatix.png","language":"Ruby","funding_links":["https://github.com/sponsors/ioquatix"],"categories":["Ruby"],"sub_categories":[],"readme":"# ![Relaxo](logo.svg)\n\nRelaxo is a transactional database built on top of git. It's aim is to provide a robust interface for document storage and sorted indexes. If you prefer a higher level interface, you can try [relaxo-model](https://github.com/ioquatix/relaxo-model).\n\n[![Development Status](https://github.com/ioquatix/relaxo/workflows/Test/badge.svg)](https://github.com/ioquatix/relaxo/actions?workflow=Test)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n``` ruby\ngem 'relaxo'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install relaxo\n\n## Usage\n\nConnect to a local database and manipulate some documents.\n\n``` ruby\nrequire 'relaxo'\nrequire 'msgpack'\n\nDB = Relaxo.connect(\"test\")\n\nDB.commit(message: \"Create test data\") do |dataset|\n\tobject = dataset.append(MessagePack.dump({bob: 'dole'}))\n\tdataset.write(\"doc1.msgpack\", object)\nend\n\nDB.commit(message: \"Update test data\") do |dataset|\n\tdoc = MessagePack.load dataset.read('doc1.msgpack').data\n\tdoc[:foo] = 'bar'\n\n\tobject = dataset.append(MessagePack.dump(doc))\n\tdataset.write(\"doc2.msgpack\", object)\nend\n\ndoc = MessagePack.load DB.current['doc2.msgpack'].data\nputs doc\n# =\u003e {\"bob\"=\u003e\"dole\", \"foo\"=\u003e\"bar\"}\n```\n\n### Document Storage\n\nRelaxo uses the git persistent data structure for storing documents. This data structure exposes a file-system like interface, which stores any kind of data. This means that you are free to use JSON, or BSON, or MessagePack, or JPEG, or XML, or any combination of those.\n\nRelaxo has a transactional model for both reading and writing.\n\n#### Authors\n\nBy default, Relaxo sets up the repository author using the login name and hostname of the current session. You can explicitly change this by modifying `database.config`. Additionally, you can set this per-commit:\n\n``` ruby\ndatabase.commit(message: \"Testing Enumeration\", author: {user: \"Alice\", email: \"alice@localhost\"}) do |dataset|\n\tobject = dataset.append(\"Hello World!\")\n\tdataset.write(\"hello.txt\", object)\nend\n```\n\n#### Reading Files\n\n``` ruby\npath = \"path/to/document\"\n\nDB.current do |dataset|\n\tobject = dataset.read(path)\n\n\tputs \"The object id: #{object.oid}\"\n\tputs \"The object data size: #{object.size}\"\n\tputs \"The object data: #{object.data.inspect}\"\nend\n```\n\n#### Writing Files\n\n``` ruby\npath = \"path/to/document\"\ndata = MessagePack.dump(document)\n\nDB.commit(message: \"Adding document\") do |changeset|\n\tobject = changeset.append(data)\n\tchangeset.write(path, object)\nend\n```\n\n### Datasets and Transactions\n\n`Dataset`s and `Changeset`s are important concepts. Relaxo doesn't allow arbitrary access to data, but instead exposes the git persistent model for both reading and writing. The implications of this are that when reading or writing, you always see a consistent snapshot of the data store.\n\n### Suitability\n\nRelaxo is designed to scale to the hundreds of thousands of documents. It's designed around the git persistent data store, and therefore has some performance and concurrency limitations due to the underlying implementation.\n\nBecause it maintains a full history of all changes, the repository would continue to grow over time by default, but there are mechanisms to deal with that.\n\n#### Performance\n\nRelaxo can do anywhere from 1000-10,000 inserts per second depending on how you structure the workload.\n\n    Relaxo Performance\n    Warming up --------------------------------------\n                  single   129.000  i/100ms\n    Calculating -------------------------------------\n                  single      6.224k (±14.7%) i/s -    114.036k in  20.000025s\n      single transaction should be fast\n    Warming up --------------------------------------\n                multiple   152.000  i/100ms\n    Calculating -------------------------------------\n                multiple      1.452k (±15.2%) i/s -     28.120k in  20.101831s\n      multiple transactions should be fast\n\nReading data is lighting fast as it's loaded directly from disk and cached.\n\n### Loading Data\n\nAs Relaxo is unapologetically based on git, you can use git directly with a non-bare working directory to add any files you like. You can even point Relaxo at an existing git repository.\n\n### Durability\n\nRelaxo is based on `libgit2` and asserts that it is a transactional database. We base this assertion on:\n\n  - All writes into the object store using `libgit2` are atomic and synchronized to disk.\n  - All updates to refs are atomic and synchronized to disk.\n\nProvided these two invariants are maintained, the operation of Relaxo will be safe, even if there are unexpected interruptions to the program.\n\nThe durability guarantees of Relaxo depend on [`libgit2` calling `fsync`](https://github.com/libgit2/libgit2/pull/4030), and [this being respected by the underlying hardware](http://www.evanjones.ca/intel-ssd-durability.html). Otherwise, durability cannot be guaranteed.\n\n## Contributing\n\nWe welcome contributions to this project.\n\n1.  Fork it.\n2.  Create your feature branch (`git checkout -b my-new-feature`).\n3.  Commit your changes (`git commit -am 'Add some feature'`).\n4.  Push to the branch (`git push origin my-new-feature`).\n5.  Create new Pull Request.\n\n### Developer Certificate of Origin\n\nIn order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.\n\n### Community Guidelines\n\nThis project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioquatix%2Frelaxo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fioquatix%2Frelaxo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioquatix%2Frelaxo/lists"}