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

jesse at bestpractical.com jesse at bestpractical.com
Sun Apr 6 07:06:38 EDT 2008


Author: jesse
Date: Sun Apr  6 07:06:31 2008
New Revision: 11588

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

Log:
 r29381 at 68-247-97-201:  jesse | 2008-04-06 01:06:12 -1000
 * new_from_hashref in change and changeset


Modified: SVN-PropDB/doc/todo
==============================================================================
--- SVN-PropDB/doc/todo	(original)
+++ SVN-PropDB/doc/todo	Sun Apr  6 07:06:31 2008
@@ -1,4 +1,4 @@
-Todo Saturday
+Todo 
         
     - write tests for RT-prophet-prophet-hiveminder sync - mostly done
     
@@ -9,72 +9,37 @@
                 - 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.
 
-    - 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
+     "publish my changes for remote pulling"    - mostly done. needs test and cleanup, "publish" scp wrapper
+    - pull from a published prophet replica
+        - "hash changeset -> real changeset"
+    - use a filesystem style prophet replica 'directly' (needs a handle subclass?)
     
-            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 ;)?)
-        - send them to remote to "pull from textfile
-        - also need to send along all merge tickets we have
-                 
-        - design/implement basic non-svn sync protocol
+ 
 
     - refactor Source::integrate_changeset to get the merge ticket and let the source(dst) decide how to record them, rather than having handle do the job
+    - validation on bug tracker fields	- severity
+    - Replace this todo list with a svb database
+    - elegant support for large attachments
+    - RESTy web server API to let third-parties build non-perl apps against a Prophet Depot
+    - define a value for a property that is a reference to another record or set of records
+
 
 
 
     - sketch out RT scrips replacement
 
-    - dinner
 
 
 
 
 Saturday done
     - implement a simple Prophet::Replica::Hiveminder for "personal tasks only"
-
     - extract the reusable bits of Prophet::Replica::RT to
             Prophet::ForeignReplica
-
     - implement uuids for prophet databases DONE
-
     - light dinner
+    - dinner @done
 
     
 
@@ -83,12 +48,6 @@
 
 Todo after saturday:
 
-- validation on bug tracker fields	- severity
-- Replace this todo list with a svb database
-- elegant support for large attachments
-- RESTy web server API to let third-parties build non-perl apps against a Prophet Depot
-- define a value for a property that is a reference to another record or set of records
-
 
 
 Archive:

Modified: SVN-PropDB/lib/Prophet/Change.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Change.pm	(original)
+++ SVN-PropDB/lib/Prophet/Change.pm	Sun Apr  6 07:06:31 2008
@@ -95,4 +95,19 @@
     };
 }
 
+sub new_from_hashref {
+    my $class = shift;
+    my $uuid = shift;
+    my $hashref = shift;
+    my $self = $class->new({ node_type => $hashref->{'node_type'}, node_uuid => $uuid, change_type => $hashref->{'change_type'}});
+    foreach my $prop (keys %{$hashref->{'prop_changes'}}) {
+            $self->add_prop_change( name => $prop, 
+                    old => $hashref->{'prop_changes'}->{'old_value'},
+                    new => $hashref->{'prop_changes'}->{'new_value'}
+                );
+    }
+    return $self;
+}
+
+
 1;

Modified: SVN-PropDB/lib/Prophet/ChangeSet.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/ChangeSet.pm	(original)
+++ SVN-PropDB/lib/Prophet/ChangeSet.pm	Sun Apr  6 07:06:31 2008
@@ -91,12 +91,12 @@
     return $self->changes ? 0 : 1;
 }
 
+
+our @SERIALIZE_PROPS = (            qw(sequence_no source_uuid original_source_uuid original_sequence_no is_nullification is_resolution is_empty));
+
 sub as_hash {
     my $self = shift;
-    my $as_hash
-        = { map { $_ => $self->$_() }
-            qw(sequence_no source_uuid original_source_uuid original_sequence_no is_nullification is_resolution is_empty)
-        };
+    my $as_hash = { map { $_ => $self->$_() } @SERIALIZE_PROPS };
 
     for my $change ( $self->changes ) {
 
@@ -105,4 +105,16 @@
     return $as_hash;
 }
 
+sub new_from_hashref {
+    my $class = shift;
+    my $hashref = shift;
+    my $self = $class->new({ map  { $_ => $hashref->{$_}  } @SERIALIZE_PROPS });
+
+    foreach my $change (keys %{$hashref->{changes}}) {
+            $self->add_change(Prophet::Change->new_from_hashref($change => $hashref->{changes}->{$change}))
+    }
+    return $self;
+}
+
+
 1;

Modified: SVN-PropDB/lib/Prophet/Replica.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica.pm	Sun Apr  6 07:06:31 2008
@@ -420,6 +420,44 @@
 use Digest::SHA1 qw(sha1 sha1_hex);
 use XML::Simple;
 
+=head2 export_to
+
+
+filesystem replica type
+ 
+ $URL
+    /<db-uuid>/
+        /replica-uuid
+        /latest
+        /cas/<substr(sha1,0,1)>/substr(sha1,1,1)/<sha1>
+        /records (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
+                ...
+
+=cut
+
+
 sub export_to {
     my $self = shift;
     my $path = shift;



More information about the Bps-public-commit mailing list