{"id":13612530,"url":"https://github.com/ostinelli/ram","last_synced_at":"2025-04-07T06:08:38.921Z","repository":{"id":45319152,"uuid":"438740859","full_name":"ostinelli/ram","owner":"ostinelli","description":"A distributed KV store for Erlang and Elixir.","archived":false,"fork":false,"pushed_at":"2023-09-11T23:18:05.000Z","size":89,"stargazers_count":119,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T04:07:48.075Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Erlang","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/ostinelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2021-12-15T18:57:54.000Z","updated_at":"2025-01-16T17:45:00.000Z","dependencies_parsed_at":"2024-12-16T19:13:09.631Z","dependency_job_id":"c1e658c3-7ae6-471a-ab28-51ce381faf18","html_url":"https://github.com/ostinelli/ram","commit_stats":{"total_commits":59,"total_committers":2,"mean_commits":29.5,"dds":"0.016949152542372836","last_synced_commit":"8783325cc02917aa412b4e78f546b0b427ed7759"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostinelli%2Fram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostinelli%2Fram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostinelli%2Fram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ostinelli%2Fram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ostinelli","download_url":"https://codeload.github.com/ostinelli/ram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"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":"2024-08-01T20:00:31.232Z","updated_at":"2025-04-07T06:08:38.897Z","avatar_url":"https://github.com/ostinelli.png","language":"Erlang","funding_links":[],"categories":["Erlang"],"sub_categories":[],"readme":"![CI](https://github.com/ostinelli/ram/actions/workflows/ci.yml/badge.svg) [![Hex pm](https://img.shields.io/hexpm/v/ram.svg)](https://hex.pm/packages/ram)\n\n# Ram\n**Ram** is a distributed KV store for Erlang and Elixir.\nIt chooses Consistency over Availability by using the [Raft Consensus Algorithm](https://raft.github.io/),\nand is based on Rabbit MQ's implementation [Ra](https://github.com/rabbitmq/ra).\n\n[[Documentation](https://hexdocs.pm/ram/)]\n\n## Installation\n\n### For Elixir\nAdd it to your deps:\n\n```elixir\ndefp deps do\n  [{:ram, \"~\u003e 0.5\"}]\nend\n```\n\n### For Erlang\nIf you're using [rebar3](https://github.com/erlang/rebar3), add `ram` as a dependency in your project's `rebar.config` file:\n\n```erlang\n{deps, [\n  {ram, {git, \"git://github.com/ostinelli/ram.git\", {tag, \"0.5.0\"}}}\n]}.\n```\nOr, if you're using [Hex.pm](https://hex.pm/) as package manager (with the [rebar3_hex](https://github.com/hexpm/rebar3_hex) plugin):\n\n```erlang\n{deps, [\n  {ram, \"0.5.0\"}\n]}.\n```\n\n## Quick start\n\n\u003e Note: this example below assumes that you are familiar with [Distributed Erlang](https://www.erlang.org/doc/reference_manual/distributed.html).\n\n### Elixir\nOpen 3 shells and start three Erlang nodes:\n\n```bash\n$ iex --name ram1@127.0.0.1 -S mix\n```\n\n```bash\n$ iex --name ram2@127.0.0.1 -S mix\n```\n\n```bash\n$ iex --name ram3@127.0.0.1 -S mix\n```\n\nChoose the main node (for instance `ram1@127.0.0.1`), and on that node run the following.\n\nFirst, create an Erlang cluster by connecting all nodes:\n```erlang\niex(ram1@127.0.0.1)1\u003e nodes = [:\"ram1@127.0.0.1\", :\"ram2@127.0.0.1\", :\"ram3@127.0.0.1\"]\n[:\"ram1@127.0.0.1\", :\"ram2@127.0.0.1\", :\"ram3@127.0.0.1\"]\niex(ram1@127.0.0.1)2\u003e for node \u003c- nodes, do: Node.connect(node)\n[true, true, true]\n```\n\nNow we can create a Ram cluster running on these nodes:\n\n```erlang\niex(ram1@127.0.0.1)3\u003e :ram.start_cluster(nodes)\n13:03:12.902 [info]  RAM[ram1@127.0.0.1] Cluster started on [:\"ram1@127.0.0.1\", :\"ram2@127.0.0.1\", :\"ram3@127.0.0.1\"]\n:ok\n```\n\nYou can now store and retrieve values from all the nodes:\n\n```erlang\niex(ram1@127.0.0.1)4\u003e :ram.put(\"key\", \"value\")\n:ok\niex(ram1@127.0.0.1)5\u003e :ram.get(\"key\")\n\"value\"\n```\n\n```erlang\niex(ram2@127.0.0.1)1\u003e :ram.get(\"key\")\n\"value\"\n```\n\n```erlang\niex(ram3@127.0.0.1)1\u003e :ram.get(\"key\")\n\"value\"\n```\n\n### Erlang\nOpen 3 shells and start three Erlang nodes:\n\n```bash\n$ rebar3 shell --name ram1@127.0.0.1\n```\n\n```bash\n$ rebar3 shell --name ram2@127.0.0.1\n```\n\n```bash\n$ rebar3 shell --name ram3@127.0.0.1\n```\n\nChoose the main node (for instance `ram1@127.0.0.1`), and on that node run the following.\n\nFirst, create an Erlang cluster by connecting all nodes:\n```erlang\n(ram1@127.0.0.1)1\u003e Nodes = ['ram1@127.0.0.1', 'ram2@127.0.0.1', 'ram3@127.0.0.1'].\n['ram1@127.0.0.1','ram2@127.0.0.1','ram3@127.0.0.1']\n(ram1@127.0.0.1)2\u003e [net_kernel:connect_node(Node) || Node \u003c- Nodes].\n[true,true,true]\n```\n\nNow we can create a Ram cluster running on these nodes:\n\n```erlang\n(ram1@127.0.0.1)3\u003e ram:start_cluster(Nodes).\n=INFO REPORT==== 4-Jan-2022::12:46:34.071524 ===\nRAM[ram1@127.0.0.1] Cluster started on ['ram1@127.0.0.1','ram2@127.0.0.1',\n'ram3@127.0.0.1']\nok\n```\n\nYou can now store and retrieve values from all the nodes:\n\n```erlang\n(ram1@127.0.0.1)4\u003e ram:put(\"key\", \"value\"). \nok\n(ram1@127.0.0.1)5\u003e ram:get(\"key\").\n\"value\"\n```\n\n```erlang\n(ram2@127.0.0.1)1\u003e ram:get(\"key\").\n\"value\"\n```\n\n```erlang\n(ram3@127.0.0.1)1\u003e ram:get(\"key\").\n\"value\"\n```\n\n## Configuration Options\n\n### release_cursor_count\nSpecifies after how many logs `ram` should create a `ra` snapshot. Defaults to `1000`.\n\n#### Elixir\n  \n```elixir\nconfig :ram,\n  release_cursor_count: 1000\n```\n\n#### Erlang\n\n```erlang\n{ram, [\n  {release_cursor_count, 1000}\n]}\n```\n\n### Other settings\nSince Ram uses [Ra](https://github.com/rabbitmq/ra), please refer to Ra's\n[documentation](https://github.com/rabbitmq/ra#configuration-reference) on available options.\n\n## Contributing\nSo you want to contribute? That's great! Please follow the guidelines below. It will make it easier to get merged in.\n\nBefore implementing a new feature, please submit a ticket to discuss what you intend to do.\nYour feature might already be in the works, or an alternative implementation might have already been discussed.\n\nDo not commit to master in your fork. Provide a clean branch without merge commits.\nEvery pull request should have its own topic branch. In this way, every additional adjustments to the original pull request\nmight be done easily, and squashed with `git rebase -i`. The updated branch will be visible in the same pull request,\nso there will be no need to open new pull requests when there are changes to be applied.\n\nEnsure that proper testing is included. To run Ram tests you simply have to be in the project's root directory and run:\n\n```bash\n$ make test\n```\n\n## License\n\nCopyright (c) 2021-2022 Roberto Ostinelli.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fostinelli%2Fram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fostinelli%2Fram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fostinelli%2Fram/lists"}