[Bps-public-commit] r11379 - in SVN-PropDB/lib/Prophet: Resolver

clkao at bestpractical.com clkao at bestpractical.com
Wed Apr 2 00:26:18 EDT 2008


Author: clkao
Date: Wed Apr  2 00:26:13 2008
New Revision: 11379

Modified:
   SVN-PropDB/lib/Prophet/Handle.pm
   SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm

Log:
resdb now stores all resolutions by all replica.

Modified: SVN-PropDB/lib/Prophet/Handle.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Handle.pm	(original)
+++ SVN-PropDB/lib/Prophet/Handle.pm	Wed Apr  2 00:26:13 2008
@@ -144,14 +144,23 @@
     $self->commit_edit();
 }
 
+=head2 record_resolution
+
+Called ONLY on local resolution creation. (Synced resolutions are just synced as records)
+
+=cut
+
+
 sub record_resolution {
-    my ($self, $change) = @_;
-    
-    # XXX for now, ignore if there's existing stored resolution on this conflict
-    return if $self->node_exists( uuid => $change->resolution_cas, type => '_prophet_resolution' );
-    $self->create_node( uuid => $change->resolution_cas, type => '_prophet_resolution',
-                        props => { _meta => $change->change_type,
-                                    map { $_->name => $_->new_value } $change->prop_changes } );
+    my ( $self, $change ) = @_;
+
+    return 1 if $self->node_exists( uuid => $self->uuid,
+        type => '_prophet_resolution-' . $change->resolution_cas );
+
+    $self->create_node( uuid => $self->uuid,
+        type => '_prophet_resolution-' . $change->resolution_cas,
+        props => { _meta => $change->change_type,
+            map { $_->name => $_->new_value } $change->prop_changes } );
 }
 
 sub record_changeset {

Modified: SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm	(original)
+++ SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm	Wed Apr  2 00:26:13 2008
@@ -9,12 +9,17 @@
     my $self = shift;
     my $conflicting_change = shift;
     my $conflict = shift;
-    my $resdb = shift;
+    my $resdb = shift; # XXX: we want diffrent collection actually now
 
-    # XXX: turn this into an explicit load?
-    $resdb->matching( sub { $_[0]->uuid eq $conflicting_change->cas_key });
-    my $answer = $resdb->as_array_ref->[0] or return;
+    my $res = Prophet::Collection->new( handle => $resdb->handle,
+                                        type => '_prophet_resolution-'.$conflicting_change->cas_key );
+    $res->matching(sub { 1 } );
+    my $answer = $res->as_array_ref->[0];
+#    for my $answer (@{$res->as_array_ref}) {
+        
+#    }
     
+    warn $answer;
     my $resolution = Prophet::Change->new_from_conflict($conflicting_change);
     for my $prop_conflict ( @{ $conflicting_change->prop_conflicts } ) {
         $resolution->add_prop_change(



More information about the Bps-public-commit mailing list