[Nitro] OG RFC: Manager-Store-Adapter options and new store_details attr

George Moschovitis george.moschovitis at gmail.com
Mon Sep 10 04:05:52 EDT 2007


Let me think a bit about this and i will get back to you. Things are kinf of
hectic here. Thanks for your work and useful posts to this list.

regards,
George.

On 9/10/07, Mark Van De Vyver <mvyver at gmail.com> wrote:
>
> Hi,
> As you'd have seen from some earlier emails, I've been getting up to
> speed on the OG Manager-Store-Adapter relation.
>
> Currently, start-up options are passed from manger to adapter and
> immediately are out of sync: manage.options indicates nothing about
> the options that store has used.  Store @options isn't readable or
> settable.  To sync and provide some flexibility I'll need later I
> thought to make the following changes - these shouldn't break existing
> behavior, and are the smallest I could come up with that give the
> flexibility I think I'll need.
>
> Maybe use details instead of store_details?
>
> Comments welcome.
>
> Mark
>
> # start ruby script
>
> require "pp"
>
> module Og
>
>   class Manager
>     attr_accessor :options
>     attr_accessor :store
>     def initialize(options)
>
>       @store = Adapter.new(options)
>       # new sync manager and store options data
>       @options = @store.store_details[:options]
>     end
>   end
>
>   class Store
>
>     attr_accessor :ogmanager
>     attr_accessor :store_details # new
>
>     def initialize(options)
>       @store_details={} # new
>       @store_details[:options] ||= options # new
>       @options = @store_details[:options] # same content & behavior
>     end
>
>   end
>
>   class SQLstore < Store  # no changes here
>     def initialize(options)
>       super
>     end
>   end
>
>     class Adapter < SQLstore  # no changes here
>
>     def initialize(options)
>       super
>     end
>
>   end
>
> end
>
> @manager = Og::Manager.new({:adapter => :dbi})
>
> pp @manager.options
> pp @manager.store.store_details[:options]
> @manager.store.store_details[:dbi_driver]=:mysql
> pp @manager.store.store_details
> @manager.store.store_details[:options][:dbi_driver]=:mysql
> pp @manager.options
> pp @manager.store.store_details[:options]
> pp @manager.store.store_details
> pp @manager.options
> @manager.options[:new]="option"
> pp @manager.store.store_details[:options]
> pp @manager.options
>
> # end ruby script
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>



-- 
http://www.me.gr
http://phidz.com
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070910/b822d276/attachment-0001.html 


More information about the Nitro-general mailing list