-
Notifications
You must be signed in to change notification settings - Fork 276
Multitenancy
You can split the graph database (and the lucene database) into separated parts by setting the reference node.
Example (using Neo4j::Rails::Model) :
a = User.all[0] # could be any Neo4j node object
b = User.all[1]
Neo4j.threadlocal_ref_node = a # store this in the current thread
Product.create(:name=>'p')
Product.all.size #=> 1
Product.find('name: p') #=> the product p
Neo4j.threadlocal_ref_node = b
Product.all.size #=> 0
Product.find('name: p') #=> nil
If you want to share data between different users, example:
class Shared < Neo4j::Rails::Model
property :foo
ref_node { Neo4j.default_ref_node }
end
When used from rails the thread context variable Neo4j.threadlocal_ref_node is automtically reset after each request (Rack Middleware). The same is true for lucene connections.
Multitenency is supported for both Neo4j::NodeMixin and Neo4j::Rails::Model.
For more information – multitenancy-with-neo4jrb.
In Neo4j there is just one reference node. Neo4j.rb has support for having more than one reference node. Instead of returning the reference node from the Java API, neo4j.rb uses the thread local storage where the user can have his own node as a reference node. By doing that the lucene files will also be prefixed so that the lucene database is also split.
WARNING: Much of the information in this wiki is out of date. We are in the process of moving things to readthedocs
- Project Introduction
- Neo4j::ActiveNode
- Neo4j::ActiveRel
- Search and Scope
- Validation, Uniqueness, and Case Sensitivity
- Indexing VS Legacy Indexing
- Optimized Methods
- Inheritance
- Core: Nodes & Rels
- Introduction
- Persistence
- Find : Lucene
- Relationships
- Third Party Gems & extensions
- Scaffolding & Generators
- HA Cluster