[Bps-public-commit] r11253 - in SVN-PropDB: . doc

jesse at bestpractical.com jesse at bestpractical.com
Fri Mar 28 14:31:35 EDT 2008


Author: jesse
Date: Fri Mar 28 14:31:32 2008
New Revision: 11253

Modified:
   SVN-PropDB/   (props changed)
   SVN-PropDB/doc/todo
   SVN-PropDB/lib/Prophet/Conflict.pm

Log:
 r28752 at 100:  jesse | 2008-03-28 08:40:03 -0400
 checkpoint


Modified: SVN-PropDB/doc/todo
==============================================================================
--- SVN-PropDB/doc/todo	(original)
+++ SVN-PropDB/doc/todo	Fri Mar 28 14:31:32 2008
@@ -1,10 +1,17 @@
+
+Done, I think.
+
 - when committing any change:
     - record the original depot uuid and change sequence_no as revprops
     - record two merge tickets:
         - sequence_no from the source that gave it to us
         - sequence_no from the original recording source
 
+- naive support for large attachments
+
+
 
+Todo
 
 - implement merge of conflicts with: "local always wins"
 
@@ -12,6 +19,5 @@
 
 - ability to 'pull' conflicting updates from a remote db
 - base bug tracking schemb
-- naive support for large attachments
 - elegant support for large attachments
 - Replace this todo list with a svb database

Modified: SVN-PropDB/lib/Prophet/Conflict.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Conflict.pm	(original)
+++ SVN-PropDB/lib/Prophet/Conflict.pm	Fri Mar 28 14:31:32 2008
@@ -7,11 +7,13 @@
 use Prophet::ConflictingPropChange;
 use Prophet::ConflictingChange;
 
-__PACKAGE__->mk_accessors(qw/prophet_handle   source_change target_change nullification/);
+__PACKAGE__->mk_accessors(qw/prophet_handle   nullification_changeset resolution_changeset autoresolved/);
 
 =head2 analyze_changeset Prophet::ChangeSet
 
-Take a look at a changeset. if there are any conflicts, populate the L<conflicting_changes> array on this object with a set of L<Prophet::ConflictingChange> objects.
+Take a look at a changeset. if there are any conflicts, populate
+the L<conflicting_changes> array on this object with a set of
+L<Prophet::ConflictingChange> objects.
 
 =cut
 
@@ -21,13 +23,65 @@
 
     $self->generate_changeset_conflicts($changeset);
     $self->generate_nullification_changeset;
-    $self->generate_conflict_resolution;
-
+    $self->attempt_automatic_conflict_resolution;
 
     return 1;
 
 }
 
+=head2 attempt_automatic_conflict_resolution
+
+Given a L<Prophet::Conflict> which can not be cleanly applied to a
+replica, it is sometimes possible to automatically determine a sane
+resolution to the conflict.
+
+=over
+
+=item When the new-state of the conflicting change matches the
+previous head of the replica.
+
+=item When someone else has previously done the resolution and we
+have a copy of that hanging aroun
+
+** This bit seems hard
+
+=back
+
+
+In those cases, this routine will generate a L<Prophet::ChangeSet> which resolves 
+as many conflicts as possible.
+
+It will then update $self->conflicting_changes to mark which
+L<Prophet::ConflictingChange>s and L<Prophet::ConflictingPropChanges>
+have been automatically resolved.
+
+
+=cut
+
+
+sub attempt_automatic_conflict_resolution {
+    my $self = shift;
+
+
+    # for everything from the changeset that is the same as the old value of the target replica
+        # we can skip applying 
+
+    die "have not implemented automatic conflict resolution yet";
+    $self->autoresolved(1);
+
+
+
+
+}
+
+
+=head2 generate_changeset_conflicts Prophet::ChangeSet
+
+Given a changeset, populates $self->conflicting_changes with all the conflicts that applying that changeset to the target replica would result in.
+
+=cut
+
+
 sub generate_changeset_conflicts {
     my $self = shift;
     my ($changeset) = validate_pos( @_, { isa => 'Prophet::ChangeSet' } );
@@ -38,6 +92,13 @@
     }
 }
 
+
+=head2 _generate_change_conflicts Prophet::Change
+
+Given a change, generates a set of Prophet::ConflictingChange entries.
+
+=cut
+
 sub _generate_change_conflicts {
     my $self = shift;
     my ($change) = validate_pos( @_, { isa => "Prophet::Change" } );
@@ -70,6 +131,13 @@
 }
 
 
+=head2 _generate_prop_change_conflicts Prophet::Change %hash_of_current_properties
+
+Given a change and the current state of a node, returns an array of Prophet::ConflictingPropChange objects describing conflicts which would occur if the change were applied
+
+
+=cut
+
 sub _generate_prop_change_conflicts {
     my $self          = shift;
     my $change        = shift;
@@ -112,6 +180,19 @@
     return $self->{'conflicting_changes'};
 }
 
+
+=head2 generate_nullification_changeset
+
+In order to record a changeset which might not apply cleanly to the
+current state of a replica, Prophet generates a I<nullification
+changeset>. That is, a changeset which sets the state of the replica
+back to what it needs to be in order to apply the new changeset.
+
+This routine computes a new L<Prophet::ChangeSet> which contains
+everything needed to nullify the conflicting state of the replica.
+
+=cut
+
 sub generate_nullification_changeset {
     my $self = shift;
     my $nullification = Prophet::ChangeSet->new();



More information about the Bps-public-commit mailing list