Swarmclient-rb
Installation
Add this line to your application's Gemfile:
gem 'swarmclient'
And then execute:
$ bundle
Or build and install from src:
$ git clone https://github.com/wlwanpan/swarmclient-rb.git
$ cd swarmclient-rb && bundle install
$ gem build swarmclient.gemspec
$ gem install swarmclient-{GEM_VERSION}.gem
Communication API (Swarmclient::Communication)
Require and Initialize
require 'swarmclient'
bluzelle = Swarmclient::Communication.new endpoint: '127.0.0.1', port: 51010, uuid: '80174b53-2dda-49f1-9d6a-6a780d4'
Note: The uuid is the unique id of a referenced db hosted in the swarm. Generate a new one to generate a new database. The gem will default to: "8c073d96-7291-11e8-adc0-fa7ae01bbebc" if none is provided.
Create New Entry (key-value)
bluzelle.create 'myKey', 'Your Value'
- Result
=> true
Read Key
bluzelle.read 'myKey'
- Result
=> "Your Value"
Update Key value
bluzelle.update 'myKey', 'New Value'
- Result
=> true
Remove Key
bluzelle.remove 'myKey'
- Result
=> true
Check if key exist
bluzelle.has 'myKey'
- Result
=> true
Read all keys stored
bluzelle.keys
- Result
=> ["myKey"]
Get size of database
bluzelle.size
- Result
=> 1
Reference
Visit the official bluzelle documentation
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To 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 tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/wlwanpan/swarmclient-rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is under the terms of the Apache License.