module Sequel::Plugins::Sharding::ClassMethods

  1. lib/sequel/plugins/sharding.rb

Public Instance methods

create_using_server(s, values=OPTS, &block)

Create a new object on the given shard s.

[show source]
   # File lib/sequel/plugins/sharding.rb
24 def create_using_server(s, values=OPTS, &block)
25   new_using_server(s, values, &block).save
26 end
eager_load_results(opts, eo, &block)

Eager load the association with the given eager loader options.

[show source]
   # File lib/sequel/plugins/sharding.rb
29 def eager_load_results(opts, eo, &block)
30   if (s = eo[:self]) && (server = s.opts[:server])
31     eb = eo[:eager_block]
32     set_server = proc do |ds|
33       ds = eb.call(ds) if eb
34       ds = ds.server?(server)
35       ds
36     end
37     eo = Hash[eo]
38     eo[:eager_block] = set_server
39     eo
40   end
41 
42   super
43 end
new_using_server(s, values=OPTS, &block)

Return a newly instantiated object that is tied to the given shard s. When the object is saved, a record will be inserted on shard s.

[show source]
   # File lib/sequel/plugins/sharding.rb
48 def new_using_server(s, values=OPTS, &block)
49   new(values, &block).set_server(s)
50 end