Replication in RavenDb is pretty fekin sweet. I helped Oren by submitting bugs and testing it out in sonatribe dev by pushing it in a real world usage scenario. One of the features I asked about was the ability to filter out parts of the namespace for replication – instead of the ‘all or nothing’ approach used by default. Oren (as you’d expect) simply replied with a request for a patch. So here is my patch.
My fork is here: https://github.com/wayne-o/ravendb
Basically – my aim is to allow the developer to set replication filters – so only a part of a namespace is replicated – rather than the whole db. To do this I’ve added a ReplicationPredicate class in the Raven.Bundles.Replication.Data namespace. this is used when initialising the db:
it’s a work in progress but i’m finding it hard to get the time to commit to it due to the new baby. if anyone fancies lending a hand – there’s a test in the SimpleReplication.cs file Can_filter_replication_using_replication_predicates
w://
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string[] predicates = { "accounts/" }; | |
using (var session = store.OpenSession()) | |
{ | |
session.Store(new ReplicationDocument | |
{ | |
ReplicationFilterPredicates = predicates.Select(x=> new ReplicationPredicate | |
{ | |
Predicate = x | |
}).ToList(), | |
Destinations = {new ReplicationDestination | |
{ | |
Url = servers[dest].Database.Configuration.ServerUrl | |
} | |
} | |
}); | |
session.SaveChanges(); | |
} |
My fork is here: https://github.com/wayne-o/ravendb
Basically – my aim is to allow the developer to set replication filters – so only a part of a namespace is replicated – rather than the whole db. To do this I’ve added a ReplicationPredicate class in the Raven.Bundles.Replication.Data namespace. this is used when initialising the db:
it’s a work in progress but i’m finding it hard to get the time to commit to it due to the new baby. if anyone fancies lending a hand – there’s a test in the SimpleReplication.cs file Can_filter_replication_using_replication_predicates
w://
Comments
Post a Comment