README.md in mixed_gauge-0.1.3 vs README.md in mixed_gauge-0.1.4
- old
+ new
@@ -63,10 +63,11 @@
end
```
Use `.get` to retrive single model class which is connected to proper
database node. Use `.put!` to create new record to proper database node.
+
`.all_shards` enables you to all model class which is connected to all
database nodes in the cluster.
```ruby
User.put!(email: 'alice@example.com', name: 'alice')
@@ -76,10 +77,19 @@
alice.save!
User.all_shards.flat_map {|m| m.find_by(name: 'alice') }.compact
```
+When you want to execute queries in parallel, use `.all_shards_in_parallel`.
+It returns `Mixedgauge::AllShardsInParallel` and it offers some collection
+actions which runs in parallel. It is aliased to `.parallel`.
+
+```ruby
+User.all_shards_in_parallel.map(&count) #=> 1
+User.parallel.flat_map {|m| m.where(age: 1) }.size #=> 1
+```
+
When you want find by non-distkey, not recomended though, you can define finder
methods to model class.
```ruby
class User < ActiveRecord::Base
@@ -87,11 +97,11 @@
use_cluster :user
def_distkey :email
parent_methods do
def find_from_all_by_name(name)
- all_shards.map {|m| m.find_by(name: name) }.compact.first
+ all_shards_in_parallel.map {|m| m.find_by(name: name) }.compact.first
end
end
end
alice = User.find_from_all_by_name('Alice')
@@ -155,18 +165,8 @@
Or install it yourself as:
$ gem install mixed_gauge
-## Development
-
-After checking out the repo, run `bin/setup` to install dependencies. Then, 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
-
## Contributing
-1. Fork it ( https://github.com/[my-github-username]/mixed_gauge/fork )
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create a new Pull Request
+Feel free to pull request and issue :)