[Bps-public-commit] r11581 - in SVN-PropDB: . doc lib/Prophet

jesse at bestpractical.com jesse at bestpractical.com
Sun Apr 6 05:53:12 EDT 2008


Author: jesse
Date: Sun Apr  6 05:53:09 2008
New Revision: 11581

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

Log:
 r29365 at 68-247-97-201:  jesse | 2008-04-05 23:24:46 -1000
 * starting to refactor toward serializing changesets


Modified: SVN-PropDB/doc/todo
==============================================================================
--- SVN-PropDB/doc/todo	(original)
+++ SVN-PropDB/doc/todo	Sun Apr  6 05:53:09 2008
@@ -1,6 +1,6 @@
 Todo Saturday
         
-    - write tests for RT-prophet-prophet-hiveminder sync
+    - write tests for RT-prophet-prophet-hiveminder sync - mostly done
     
             
                 
@@ -9,7 +9,44 @@
                 - yes. in general, dbs should be initialized with pull or be new projects
                 - merging between replicas with different uuids should require a 'force' argument of some kind.
 
-    - light dinner
+    - pull from a remote prophet
+
+ "publish my changes for remote pulling"
+ 
+ $URL
+    /<db-uuid>/
+        /replica-uuid
+        /latest
+        /cas/<substr(sha1,0,1)>/substr(sha1,1,1)/<sha1>
+        /content (optional?)
+            /<record type> (for resolution is actually _prophet-resolution-<cas-key>)
+                /<record uuid> which is a file containing a list of 0 or more rows
+                    last-changed-sequence-no : cas key
+                                    
+        /changesets.idx
+    
+            index which has records:
+                each record is : local-replica-seq-no : original-uuid : original-seq-no : cas key
+            ...
+    
+        /resolutions/
+            /replica-uuid
+            /latest
+            /cas/<substr(sha1,0,1)>/substr(sha1,1,1)/<sha1>
+            /content (optional?)
+                /_prophet-resolution-<cas-key>   (cas-key == a hash the conflicting change)
+                    /<record uuid>  (record uuid == the originating replica)
+                        last-changed-sequence-no : <cas key to the content of the resolution>
+                                        
+            /changesets.idx
+                index which has records:
+                    each record is : local-replica-seq-no : original-uuid : original-seq-no : cas key
+                ...
+ 
+ 
+    - replica publishing todo
+    
+ 
 
     - push to a remote prophet
         - bundle all changesets newer than that which we know the other party hasn't seen up as a serialized structure (FeedSync? Storable ;)?)
@@ -36,6 +73,9 @@
             Prophet::ForeignReplica
 
     - implement uuids for prophet databases DONE
+
+    - light dinner
+
     
 
 

Modified: SVN-PropDB/lib/Prophet/Replica.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica.pm	Sun Apr  6 05:53:09 2008
@@ -390,9 +390,44 @@
     return 1;     
 }
 
+=head2 fetch_changesets { after => SEQUENCE_NO } 
+
+Fetch all changesets from the source. 
+        
+Returns a reference to an array of L<Prophet::ChangeSet/> objects.
+        
+
+=cut    
+        
+sub fetch_changesets {
+    my $self = shift;
+    my %args = validate( @_, { after => 1 } );
+    my @results;
+
+    my $first_rev = ( $args{'after'} + 1 ) || 1;
+
+    # XXX TODO we should  be using a svn get_log call here rather than simple iteration
+    # clkao explains that this won't deal cleanly with cases where there are revision "holes"
+    for my $rev ( $first_rev .. $self->most_recent_changeset) {
+        push @results, $self->fetch_changeset($rev);
+    }
+
+
+    return \@results;
+}
+
     
-    
-    
+sub serialize_changeset {
+    my $self = shift;
+    my $changeset_id = shift;
+    $self->fetch_changeset($changeset_id);
+
+}
+
+
+sub serialize_node {
+
+}
 
 
 1;

Modified: SVN-PropDB/lib/Prophet/Replica/SVN.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica/SVN.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica/SVN.pm	Sun Apr  6 05:53:09 2008
@@ -66,25 +66,14 @@
     return $self->prophet_handle->repo_handle->fs->get_uuid;
 }
 
-=head2 fetch_changesets { after => SEQUENCE_NO } 
-
-Fetch all changesets from the source. 
-
-Returns a reference to an array of L<Prophet::ChangeSet/> objects.
-
-
-=cut
-
-sub fetch_changesets {
+sub most_recent_changeset {
     my $self = shift;
-    my %args = validate( @_, { after => 1 } );
-    my @results;
-
-    my $first_rev = ( $args{'after'} + 1 ) || 1;
+     $self->ra->get_latest_revnum
+}
 
-    # XXX TODO we should  be using a svn get_log call here rather than simple iteration
-    # clkao explains that this won't deal cleanly with cases where there are revision "holes"
-    for my $rev ( $first_rev .. $self->ra->get_latest_revnum ) {
+sub fetch_changeset {
+    my $self = shift;
+    my $rev = shift;
         my $editor = Prophet::Replica::SVN::ReplayEditor->new( _debug => 0 );
         $editor->ra( $self->_get_ra );
         my $pool = SVN::Pool->new_default;
@@ -93,13 +82,11 @@
         $editor->{revision} = $rev;
 
         $self->ra->replay( $rev, 0, 1, $editor );
-        push @results, $self->_recode_changeset( $editor->dump_deltas, $self->ra->rev_proplist($rev) );
+        return $self->_recode_changeset( $editor->dump_deltas, $self->ra->rev_proplist($rev) );
 
-    }
-
-    return \@results;
 }
 
+
 sub _recode_changeset {
     my $self      = shift;
     my $entry     = shift;



More information about the Bps-public-commit mailing list