Vivek, Andreas,
very interesting design! Let's see how this works out in the longer
run - if it proves useful in other scenarios, maybe this is a good
pattern to propagate to others, and to pull down into some Java
library in order to be usable from other stacks, too!

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Sun, Oct 2, 2011 at 9:12 AM, Vivek Prahlad <vivek.prah...@gmail.com> wrote:
> Hi Peter,
>
> Yes, the multitenancy support only works via rails at the moment.
>
> It basically involves a few things:
>
> 1. The ability to change reference nodes for entities. If the reference node
> is set to a tenant (for example, a Customer or an Organization object
> instance), then two things happen:
>
> All traversals are scoped to happen under the tenant node. Thus Bill.all,
> for example, will always return the collection of bills attached to the
> current reference node.
> Lucene queries are scoped to an index that's created for a particular
> tenant. For this to work, the tenant node needs to have a unique 'name'
> property.
>
> The api to make this happen is Neo4j.threadlocal_ref_node = <your tenant
> node instance>. The framework automatically does traversals and lucene index
> lookups based on the current ref node. In the rails world, one place to set
> the threadlocal ref node would be in, say, a :before_filter in your
> ApplicationController
>
> 2. The ability to have entities that are shared across all tenants. This can
> be done like this:
>
>     class Currency
>       property :name
>       ref_node { Neo4j.default_ref_node }
>     end
> This ensures that all currency instances are attached to the default
> reference node. Currency.all / find etc. will always return the same results
> regardless of what the current threadlocal ref node is. This allows us to
> create shared reference data that is common across all tenants.
>
> Cheers,
> Vivek
>
> On Sun, Oct 2, 2011 at 12:16 PM, Peter Neubauer
> <peter.neuba...@neotechnology.com> wrote:
>>
>> Very cool Andres, Vivek and Deepak,
>> The multi tenancy does only work from Rails?
>>
>> /Peter
>>
>> On Saturday, October 1, 2011, Andreas Ronge <andreas.ro...@gmail.com>
>> wrote:
>> > Hi
>> >
>> > I just released 1.2.3.
>> > See the documentation for the new cool feature - multitenancy -
>> > http://neo4j.rubyforge.org/guides/configuration.html#multitenancy
>> >
>> > CHANGELOG
>> > * Multitenancy support by namespaced-indices & changeable reference
>> > node (Vivek Prahlad, pull 41)
>> > * Added a Neo4j::Rails::Model#columns which returns all defined
>> > properties [#186]
>> > * Fixed validation associated entities, parent model should be invalid
>> > if its nested model(s) is invalid (Vivek Prahlad)
>> > * Fixed property validation to read value before conversion as per
>> > active model conventions (Deepak N)
>> > * Fixed property_before_type_cast for loaded models (Deepak N)
>> > * Better support for nested models via ActionView field_for [#185]
>> > * BUG: fix for null pointer issue after delete_all on
>> > Neo4j::Rails::Model#has_n relationships (Vivek Prahlad)
>> > * BUG: init_on_create was not called when creating a new relationship
>> > via the << operator [#183]
>> >
>> > Thanks again Deepak and Vivek !
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "neo4jrb" group.
>> > To post to this group, send email to neo4...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > neo4jrb+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/neo4jrb?hl=en.
>> >
>> >
>>
>> --
>>
>> Cheers,
>>
>> /peter neubauer
>>
>> GTalk:      neubauer.peter
>> Skype       peter.neubauer
>> Phone       +46 704 106975
>> LinkedIn   http://www.linkedin.com/in/neubauer
>> Twitter      http://twitter.com/peterneubauer
>>
>> http://www.neo4j.org               - Your high performance graph database.
>> http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "neo4jrb" group.
>> To post to this group, send email to neo4...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> neo4jrb+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/neo4jrb?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "neo4jrb" group.
> To post to this group, send email to neo4...@googlegroups.com.
> To unsubscribe from this group, send email to
> neo4jrb+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/neo4jrb?hl=en.
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to