{"id":19032473,"url":"https://github.com/creadone/karmarb","last_synced_at":"2025-08-09T04:10:21.824Z","repository":{"id":178726422,"uuid":"662291802","full_name":"creadone/karmarb","owner":"creadone","description":"Ruby client for Karma","archived":false,"fork":false,"pushed_at":"2023-07-16T12:55:11.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T00:29:57.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/creadone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-07-04T19:48:02.000Z","updated_at":"2023-07-04T19:48:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"4750fbe2-056e-4d0c-80ed-92839faf817a","html_url":"https://github.com/creadone/karmarb","commit_stats":null,"previous_names":["creadone/karmarb"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/creadone/karmarb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creadone%2Fkarmarb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creadone%2Fkarmarb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creadone%2Fkarmarb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creadone%2Fkarmarb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/creadone","download_url":"https://codeload.github.com/creadone/karmarb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creadone%2Fkarmarb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269528435,"owners_count":24432655,"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-09T02:00:10.424Z","response_time":111,"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":[],"created_at":"2024-11-08T21:28:48.766Z","updated_at":"2025-08-09T04:10:21.762Z","avatar_url":"https://github.com/creadone.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Karma\n\nKarma is a ~key-value~ key-counter database, you can find it in a separate [repository](https://github.com/creadone/karma). This repo contains straightforward Ruby client for Karma.\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add karma\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install karma\n\n## Configuration\n\n```Ruby\nrequire 'karma'\n\nKarma.configure do |config|\n  config.port = 8080\n  config.host = \"localhost\"\nend\n\n```\n\n## Usage\n\nThe client supports all possible functionality, which means that Karma can be fully managed by commands. Each command returns an execution status in the `success` attribute and an execution result or an error in the `result` attribute. For example:\n\n```Ruby\n# Deletes an existing tree\nKarma.drop('comments')\n\n# success: \u003cOpenStruct success=true, response=\"OK\"\u003e\n# error: \u003cOpenStruct success=false, response=\"Tree \\\"comments\\\" not exists\"\u003e\n```\n\nThe control commands allow you to maintain the database:\n\n```Ruby\n# Checks the server\nKarma.ping\n\n# Creates new tree \"comments\" or check if exists\nKarma.create('comments')\n\n# Get list of trees in the memory\nKarma.trees\n\n# Delete tree \"comments\"\nKarma.drop('comments')\n\n# Get list of all dumps\nKarma.dumps\n\n# Dumps tree to the backup directory\nKarma.dump('comments')\n\n# Make a backup on FS for each tree in memory\nKarma.dump_all\n\n# Load a dump of the tree into memory (existing tree will overwrited)\nKarma.load('1688496993_comments.tree')\n```\n\nThe tree commands allow you to work with specific tree:\n\n```Ruby\n# Increment the value in the tree for the key\nKarma.tree('comments').increment(key: 12345)\n\n# Increment the value in the tree for the key\nKarma.tree('comments').decrement(key: 12345)\n\n# Get total value in the tree for the key\nKarma.tree('comments').sum(key: 12345)\n\n# Get total value in the tree for the key between dates\nKarma.tree('comments').sum(key: 12345, time_from: 20230601, time_to: 20230629)\n\n# Get hash where key is date and value is total for key between dates\nKarma.tree('comments').find(key: 12345, time_from: 20230601, time_to: 20230629)\n\n# Get hash where key is key number and value is total over the tree between dates\nKarma.tree('comments').find(time_from: 20230601, time_to: 20230629)\n\n# Delete all values for the key between dates\nKarma.tree('comments').delete(key: 12345, time_from: 20230601, time_to: 20230629)\n\n# Delete all values over the tree between dates\nKarma.tree('comments').delete(time_from: 20230601, time_to: 20230629)\n\n# Delete all values for the key\nKarma.tree('comments').reset(key: 12345)\n\n# Delete all values for the tree\nKarma.tree('comments').reset\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/creadone/karmarb.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreadone%2Fkarmarb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreadone%2Fkarmarb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreadone%2Fkarmarb/lists"}