{"id":24101112,"url":"https://github.com/inaka/sumo_db_riak","last_synced_at":"2025-10-30T14:38:46.776Z","repository":{"id":57554772,"uuid":"51938865","full_name":"inaka/sumo_db_riak","owner":"inaka","description":"Riak adapter for sumo_db","archived":false,"fork":false,"pushed_at":"2022-01-09T22:59:20.000Z","size":134,"stargazers_count":3,"open_issues_count":7,"forks_count":7,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-05-07T23:44:39.350Z","etag":null,"topics":["erlang","hacktoberfest","riak","riak-adapter","sumo-db"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inaka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-17T16:52:43.000Z","updated_at":"2021-10-05T06:25:49.000Z","dependencies_parsed_at":"2022-09-26T18:51:27.670Z","dependency_job_id":null,"html_url":"https://github.com/inaka/sumo_db_riak","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fsumo_db_riak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fsumo_db_riak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fsumo_db_riak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fsumo_db_riak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inaka","download_url":"https://codeload.github.com/inaka/sumo_db_riak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973616,"owners_count":21834105,"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":["erlang","hacktoberfest","riak","riak-adapter","sumo-db"],"created_at":"2025-01-10T16:27:12.425Z","updated_at":"2025-10-30T14:38:41.744Z","avatar_url":"https://github.com/inaka.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sumo_db_riak\n\n[![Build Status](https://travis-ci.org/inaka/sumo_db_riak.svg?branch=master)](https://travis-ci.org/inaka/sumo_db_riak)\n\nThis is the [Riak](http://docs.basho.com/riak/latest/) adapter for [sumo_db](https://github.com/inaka/sumo_db).\n\n\n## Implementation Notes\n\nThese are some implementation notes you should know:\n\n 1. This **Riak** adapter is implemented using [Riak Data Types](http://docs.basho.com/riak/latest/dev/using/data-types/).\n 2. The modeled **sumo** docs/entities are mapped to [Riak Maps](http://docs.basho.com/riak/latest/dev/using/data-types/#Maps).\n 3. This Riak adapter allows nested docs/entities, ang again, those entities are treat them\n    as Riak Maps too.\n 4. Bulk operations such as: `delete_all/1`, `delete_by/2`, `find_all/1,4` and `find_by/2,4,5`,\n    they were optimized using streaming. Records are streamed in chunks (using [Riak 2i](http://docs.basho.com/riak/latest/dev/using/2i/)\n    to stream keys first), and then the current operation is applied. E.g: supposing\n    we are executing a `find_all/1`, all keys are fetched first, and then the values\n    corresponding to each key are fetched (remember that fetch a doc by the key is the\n    fastest way, O(1)). This allows better memory and cpu efficiency.\n 5. Query functions were implemented using [Riak Search](http://docs.basho.com/riak/latest/dev/search/search-data-types/)\n    on Data Types, to get better performance and flexibility.\n\n\n## Riak\n\n### Install Riak\n\nTo install/upgrade **Riak** please follow the instructions in this link:\n[Installing and Upgrading Riak](http://docs.basho.com/riak/latest/ops/building/installing).\n\n### Initial Configurations\n\nDue to the fact that **Riak** comes with default configuration, we need to\nchange some parameters required by `sumo_db`.\n\n**Riak** has a main configuration file `riak.conf`, which you can find into\nyour installation path `$YOUR_INSTALL_PATH/etc/riak.conf`.\n\n\u003e **Note:** For more information check this link [Configuration Files](http://docs.basho.com/riak/latest/ops/advanced/configs/configuration-files).\n\nFirst parameter to change is the default **Riak** backend from **Bitcask** to\n**LevelDB**. This change also enables the use of [Riak Secondary Indexes](http://docs.basho.com/riak/latest/ops/advanced/configs/secondary-index/).\n\n    storage_backend = leveldb\n\nThen proceed to enable search capabilities:\n\n    search = on\n\n\u003e **Note:** For more information check this link [Riak Search Settings](http://docs.basho.com/riak/latest/ops/advanced/configs/search/).\n\n### Configuring Riak Data Types and Search\n\nFirst, let's create and activate a bucket type simply called maps that is set up\nto store Riak maps:\n\nBecause `sumo_db_riak` adapter is implemented using **Riak Data Types**, and docs/entities\nare mapped to **Riak Maps**, we need to create a [Riak Bucket Type](http://docs.basho.com/riak/latest/dev/advanced/bucket-types/)\nfor those docs that will be stored.\n\nTaking as example our [tests](./test), let's call the bucket type `maps`.\n\n    $ riak-admin bucket-type create maps '{\"props\":{\"datatype\":\"map\"}}'\n    $ riak-admin bucket-type activate maps\n\nNow, let's create a search index called `sumo_test_index` using the default\nschema:\n\n    $ curl -XPUT $RIAK_HOST/search/index/sumo_test_index \\\n        -H 'Content-Type: application/json' \\\n        -d '{\"schema\":\"_yz_default\"}'\n\nWith our index created, we can associate our new `sumo_test_index` index with\nour `maps` bucket type:\n\n    $ riak-admin bucket-type update maps '{\"props\":{\"search_index\":\"sumo_test_index\"}}'\n\nNow we can start working with **Riak** from `sumo_db`.\n\n\u003e **Note:** For more information check this link [Riak Data Types and Search](http://docs.basho.com/riak/latest/dev/search/search-data-types/#Maps-Example).\n\n\n## Getting Started\n\nTo start use `sumo_db` with this Riak adapter `sumo_db_riak` is pretty easy, you only has to\nfollow these steps:\n\n 1. Add `sumo_db_riak` as dependencies in your project.\n\n```erlang\n{deps, [\n  {sumo_db_riak, \"0.1.0\"}\n]}.\n```\n\n 2. You need at least one doc/entity, let's use [sumo_test_people_riak](./test/sumo_test_people_riak.erl)\n    as example.\n\n 3. Provide the configuration file, e.g.: [test.config](./test/test.config).\n\n 4. Now you can run your app and start using `sumo` from there.\n\n### Running sumo from an Erlang console\n\n    $ rebar3 shell --config test/test.config\n\nNow you're ready to play with `sumo` and **Riak**:\n\n```erlang\n\u003e sumo:find_all(people).\n[]\n```\n\n\n## Contact Us\nIf you find any **bugs** or have a **problem** while using this library, please\n[open an issue][issue] in this repo (or a pull request :)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Fsumo_db_riak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finaka%2Fsumo_db_riak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Fsumo_db_riak/lists"}