On Dec 1, 3:48 pm, Gary Doades <[email protected]> wrote:
> On 01/12/2010 10:52 PM, Jeremy Evans wrote:> Except that that isn't the case. 
> For example, consider the case where
> > you override the :servers_hash option with Hash.new(:bev1234).
>
> > Like I said, if you'd like some documentation added/changed, please
> > submit a *patch*.  If it's not important enough for you to submit even
> > a simple documentation patch, it's probably not worth modifying the
> > documentation in the first place.
>
> Any good? Your text + mine:
>
> +++ sharding.rdoc       2010-12-01 23:42:04.682000000 +0000
> @@ -112,6 +112,30 @@
>
>     Rainbow.plaintext_for_hash("e580726d31f6e1ad216ffd87279e536d1f74e606")
>
> +  The connection pool can be further controlled to change how it
> handles attempts
> +  to access shards that haven't been configured.  The default is
> +  still to assume the :default shard.  However, you can specify a
> +  different shard using the :servers_hash option when connecting
> +  to the database:
> +
> +    DB = Sequel.connect(..., :servers_hash=>Hash.new(:some_shard))
> +
> +  You can also use this feature to raise an exception if an
> +  unconfigured shard is used:
> +
> +    DB = Sequel.connect(..., :servers_hash=>Hash.new{raise ...})
> +
> +  If you specify a :servers_hash option to raise an exception for non
> configured
> +  shards you also need to explicitly specify a :read_only entry in your
> :servers option
> +  for the case where a shard is not specified. In most cases it is
> sufficient
> +  to add a :read_only entry to use the :default shard by adding an
> entry :read_only => {}
> +
> +  servers = {:read_only => {}}
> +  (('0'..'9').to_a + ('a'..'f').to_a).each do |hex|
> +    servers[hex.to_sym] = {:host=>"hash_host_#{hex}"}
> +  end
> +  DB=Sequel.connect('postgres://hash_host/hashes', :servers=>servers,
> :servers_hash=>Hash.new{raise Exception.new("Invalid Server")})
> +
>   === Sharding Plugin
>
>   Sequel comes with a sharding plugin that makes it easy to use sharding
> with model objects.

Thanks, committed: 
https://github.com/jeremyevans/sequel/commit/a9344889317e024ab1547c567130c1c95c21091a

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to