[Bps-public-commit] Prophet branch, master, updated. 0.73-14-g39d245e

Alex M Vandiver alexmv at bestpractical.com
Fri Oct 16 19:38:14 EDT 2009


The branch, master has been updated
       via  39d245e87ac27aefc0d53cc52e484828b4243f2b (commit)
      from  8a4b57a0fec2ca9063d80cda952af415fb315115 (commit)

Summary of changes:
 lib/Prophet.pm                           |   19 +++++--
 lib/Prophet/CLI/Command/Clone.pm         |    1 +
 lib/Prophet/Change.pm                    |    4 +-
 lib/Prophet/ChangeSet.pm                 |    2 +-
 lib/Prophet/ForeignReplica.pm            |   11 +++-
 lib/Prophet/Record.pm                    |    2 +-
 lib/Prophet/Replica.pm                   |    4 +-
 lib/Prophet/Replica/prophet.pm           |    3 +-
 lib/Prophet/Replica/sqlite.pm            |    4 +
 lib/Prophet/ReplicaExporter.pm           |   10 ++--
 lib/Prophet/Resolver/IdenticalChanges.pm |   20 ++++---
 lib/Prophet/Test/Editor.pm               |    2 +
 lib/Prophet/UUIDGenerator.pm             |   93 +++++++++++++++++++++---------
 13 files changed, 118 insertions(+), 57 deletions(-)

- Log -----------------------------------------------------------------
commit 39d245e87ac27aefc0d53cc52e484828b4243f2b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 15 16:50:06 2009 -0400

    POD nitpicks

diff --git a/lib/Prophet.pm b/lib/Prophet.pm
index a19cde5..9606088 100644
--- a/lib/Prophet.pm
+++ b/lib/Prophet.pm
@@ -15,27 +15,36 @@ Prophet is a distributed database system designed for small to medium
 scale social database applications.  Our early targets include things
 such as bug tracking.
 
+
 =head2 Design goals
 
-=head3 Arbitrary record schema
+=over
+
+=item Arbitrary record schema
+
+=item Replication
 
-=head3 Replication
+=item Disconnected operation
 
-=head3 Disconnected operation
+=item Peer to peer synchronization
 
-=head3 Peer to peer synchronization
+=back
 
 
 
 =head2 Design constraints
 
-=head3 Scaling
+=over
+
+=item Scaling
 
 We don't currently intend for the first implementation of Prophet to
 scale to databases with millions of rows or hundreds of concurrent
 users. There's nothing that makes the design infeasible, but the
 infrastructure necessary for such a system will...needlessly hamstring it.
 
+=back
+
 =cut
 
 1;
diff --git a/lib/Prophet/CLI/Command/Clone.pm b/lib/Prophet/CLI/Command/Clone.pm
index b389ddf..b17490f 100644
--- a/lib/Prophet/CLI/Command/Clone.pm
+++ b/lib/Prophet/CLI/Command/Clone.pm
@@ -109,6 +109,7 @@ Probes the local network for bonjour replicas if the local arg is specified.
 Prints a list of all sources found.
 
 =cut
+
 sub list_bonjour_sources {
     my $self = shift;
     my @bonjour_sources;
diff --git a/lib/Prophet/Change.pm b/lib/Prophet/Change.pm
index b0fe6f8..52ac548 100644
--- a/lib/Prophet/Change.pm
+++ b/lib/Prophet/Change.pm
@@ -71,12 +71,12 @@ resolution or not.
 
 =head2 prop_changes [\@PROPCHANGES]
 
-Returns a list of L<Prophet::PropChange/> associated with this Change. Takes an
+Returns a list of L<Prophet::PropChange>s associated with this Change. Takes an
 optional arrayref to fully replace the set of propchanges.
 
 =head2 has_prop_changes
 
-Returns true if this change contains any L</Prophet::PropChange>s and false
+Returns true if this change contains any L<Prophet::PropChange>s and false
 if it doesn't.
 
 =head2 new_from_conflict $conflict
diff --git a/lib/Prophet/ChangeSet.pm b/lib/Prophet/ChangeSet.pm
index c3a710c..1c29440 100644
--- a/lib/Prophet/ChangeSet.pm
+++ b/lib/Prophet/ChangeSet.pm
@@ -133,7 +133,7 @@ Returns true if this changeset has any changes.
 
 =head2 add_change { change => L<Prophet::Change> }
 
-Adds a new change, L<$args{'change'}> to this changeset.
+Adds a new change to this changeset.
 
 =cut
 
diff --git a/lib/Prophet/ForeignReplica.pm b/lib/Prophet/ForeignReplica.pm
index 5e5169e..810b40f 100644
--- a/lib/Prophet/ForeignReplica.pm
+++ b/lib/Prophet/ForeignReplica.pm
@@ -5,9 +5,16 @@ extends 'Prophet::Replica';
 
 =head1 NAME
 
+Prophet::ForeignReplica
+
 =head1 DESCRIPTION
 
-This abstract baseclass implements the helpers you need to be able to easily sync a prophet replica with a "second class citizen" replica which can't exactly reconstruct changesets, doesn't use uuids to track records and so on.
+This abstract baseclass implements the helpers you need to be able to
+easily sync a prophet replica with a "second class citizen" replica
+which can't exactly reconstruct changesets, doesn't use uuids to track
+records and so on.
+
+=head1 METHODS
 
 =cut
 
@@ -37,7 +44,7 @@ sub import_resolutions_from_remote_source {
     return
 }
 
-=head3 record_changes L<Prophet::ChangeSet>
+=head2 record_changes L<Prophet::ChangeSet>
 
 Integrate all changes in this changeset.
 
diff --git a/lib/Prophet/Record.pm b/lib/Prophet/Record.pm
index 4071824..a3b7ef0 100644
--- a/lib/Prophet/Record.pm
+++ b/lib/Prophet/Record.pm
@@ -56,7 +56,7 @@ sub PROPERTIES { $PROPERTIES }
 
 =head2 new  { handle => Prophet::Replica, type => $type }
 
-Instantiates a new, empty L<Prophet::Record/> of type $type.
+Instantiates a new, empty L<Prophet::Record> of type $type.
 
 =head2 declared_props
 
diff --git a/lib/Prophet/Replica.pm b/lib/Prophet/Replica.pm
index 6169f91..b118085 100644
--- a/lib/Prophet/Replica.pm
+++ b/lib/Prophet/Replica.pm
@@ -519,7 +519,7 @@ sub changeset_will_conflict {
 
 =head3 conflicts_from_changeset L<Prophet::ChangeSet>
 
-Returns a L<Prophet::Conflict/> object if the supplied L<Prophet::ChangeSet/>
+Returns a L<Prophet::Conflict> object if the supplied L<Prophet::ChangeSet>
 will generate conflicts if applied to the current replica.
 
 Returns undef if the current changeset wouldn't generate a conflict.
@@ -587,7 +587,7 @@ sub should_accept_changeset {
 
 Fetch all changesets from this replica after the local sequence number SEQUENCE_NO.
 
-Returns a reference to an array of L<Prophet::ChangeSet/> objects.
+Returns a reference to an array of L<Prophet::ChangeSet> objects.
 
 See also L<traverse_changesets> for replica implementations to provide
 streamly interface.
diff --git a/lib/Prophet/Replica/prophet.pm b/lib/Prophet/Replica/prophet.pm
index 225a532..de1c446 100755
--- a/lib/Prophet/Replica/prophet.pm
+++ b/lib/Prophet/Replica/prophet.pm
@@ -132,7 +132,7 @@ use constant local_metadata_dir => 'local_metadata';
 =head1 Replica Format
 
 =head4 overview
- 
+
  $URL
     /<db-uuid>/
         /replica-uuid
@@ -165,7 +165,6 @@ use constant local_metadata_dir => 'local_metadata';
                     each record is : local-replica-seq-no : original-uuid : original-seq-no : cas key
                 ...
 
-
 Inside the top level directory for the mirror, you'll find a directory named as B<a hex-encoded UUID>.
 This directory is the root of the published replica. The uuid uniquely identifes the database being replicated.
 All replicas of this database will share the same UUID.
diff --git a/lib/Prophet/Replica/sqlite.pm b/lib/Prophet/Replica/sqlite.pm
index 7a570f6..146c3e3 100644
--- a/lib/Prophet/Replica/sqlite.pm
+++ b/lib/Prophet/Replica/sqlite.pm
@@ -9,6 +9,10 @@ use JSON;
 use Digest::SHA qw/sha1_hex/;
 use DBI;
 
+=head1 METHODS
+
+=cut
+
 has dbh => (
     is => 'rw',
     isa     => 'DBI::db',
diff --git a/lib/Prophet/ReplicaExporter.pm b/lib/Prophet/ReplicaExporter.pm
index ff1e752..1bde418 100644
--- a/lib/Prophet/ReplicaExporter.pm
+++ b/lib/Prophet/ReplicaExporter.pm
@@ -51,9 +51,8 @@ has app_handle => (
 Prophet::ReplicaExporter
 
 =head1 DESCRIPTION
-                        
-A utility class which exports a replica to a serialized on-disk format
 
+A utility class which exports a replica to a serialized on-disk format
 
 =cut
 
@@ -67,9 +66,10 @@ Instantiates a new replica exporter object
 
 =head2 export
 
-This routine will export a copy of this prophet database replica to a flat file on disk suitable for 
-publishing via HTTP or over a local filesystem for other Prophet replicas to clone or incorporate changes from.
-
+This routine will export a copy of this prophet database replica to a
+flat file on disk suitable for publishing via HTTP or over a local
+filesystem for other Prophet replicas to clone or incorporate changes
+from.
 
 =cut
 
diff --git a/lib/Prophet/Resolver/IdenticalChanges.pm b/lib/Prophet/Resolver/IdenticalChanges.pm
index 8ddbf57..7af1def 100644
--- a/lib/Prophet/Resolver/IdenticalChanges.pm
+++ b/lib/Prophet/Resolver/IdenticalChanges.pm
@@ -4,6 +4,8 @@ use Params::Validate qw(:all);
 use Prophet::Change;
 extends 'Prophet::Resolver';
 
+=head1 METHODS
+
 =head2 attempt_automatic_conflict_resolution
 
 Given a L<Prophet::Conflict> which can not be cleanly applied to a
@@ -12,25 +14,25 @@ resolution to the conflict.
 
 =over
 
-=item When the new-state of the conflicting change matches the
+=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
+=item *
 
-** This bit seems hard
+When someone else has previously done the resolution and we
+have a copy of that hanging around.
 
 =back
 
+In those cases, this routine will generate a L<Prophet::ChangeSet>
+which resolves as many conflicts as possible.
 
-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
+It will then update the conclicting changes to mark which
 L<Prophet::ConflictingChange>s and L<Prophet::ConflictingPropChanges>
 have been automatically resolved.
 
-
 =cut
 
 sub run {
diff --git a/lib/Prophet/Test/Editor.pm b/lib/Prophet/Test/Editor.pm
index bb5fe2b..9637b5a 100644
--- a/lib/Prophet/Test/Editor.pm
+++ b/lib/Prophet/Test/Editor.pm
@@ -6,6 +6,8 @@ use Prophet::Util;
 use Params::Validate;
 use File::Spec;
 
+=head1 METHODS
+
 =head2 edit( tmpl_files => $tmpl_files, edit_callback => sub {}, verify_callback => sub {} )
 
 Expects @ARGV to contain at least an option and a file to be edited. It
diff --git a/lib/Prophet/UUIDGenerator.pm b/lib/Prophet/UUIDGenerator.pm
index 25c390e..d411c56 100644
--- a/lib/Prophet/UUIDGenerator.pm
+++ b/lib/Prophet/UUIDGenerator.pm
@@ -2,8 +2,26 @@ package Prophet::UUIDGenerator;
 use Any::Moose;
 use MIME::Base64::URLSafe;
 
-use UUID::Tiny ':std';
+=head1 NAME
+
+Prophet::UUIDGenerator
 
+=head1 DESCRIPTION
+
+Creates UUIDs using L<UUID::Tiny>.  Initially, it created v1 and v3
+UUIDs; the new UUID scheme creates v4 and v5 UUIDs, instead.
+
+=head1 METHODS
+
+=head2 uuid_scheme
+
+Gets or sets the UUID scheme; if 1, then creates v1 and v3 UUIDs (for
+backward compatability with earlier versions of Prophet).  If 2, it
+creates v4 and v5 UUIDs.
+
+=cut
+
+use UUID::Tiny ':std';
 
 # uuid_scheme: 1 - v1 and v3 uuids.
 #              2 - v4 and v5 uuids.
@@ -13,6 +31,11 @@ has uuid_scheme => (
     is  => 'rw'
 );
 
+=head2 create_str
+
+Creates and returns v1 or v4 UUIDs, depending on L</uuid_scheme>.
+
+=cut
 
 sub create_str {
     my $self = shift;
@@ -23,6 +46,13 @@ sub create_str {
     }
 }
 
+=head2 create_string_from_url URL
+
+Creates and returns v3 or v5 UUIDs for the given C<URL>, depending on
+L</uuid_scheme>.
+
+=cut
+
 sub create_string_from_url {
     my $self = shift;
     my $url = shift;
@@ -36,11 +66,20 @@ sub create_string_from_url {
     }
 }
 
+=head2 from_string
+
+=cut
+
 sub from_string {
     my $self = shift;
     my $str = shift;
     return string_to_uuid($str);
 }
+
+=head2 to_string
+
+=cut
+
  
 sub to_string {
     my $self = shift;
@@ -48,52 +87,50 @@ sub to_string {
     return uuid_to_string($uuid);
 }
 
+=head2 from_safe_b64
+
+=cut
+
 sub from_safe_b64 {
     my $self = shift;
     my $uuid = shift;
     return urlsafe_b64decode($uuid);
 }
 
+=head2 to_safe_b64
+
+=cut
+
 sub to_safe_b64 {
     my $self = shift;
     my $uuid = shift;
     return urlsafe_b64encode($self->from_string($uuid));
 }
 
-sub version {
-	my $self = shift;
-	my $uuid = shift;
-	return version_of_uuid($uuid);
-}
-
-sub set_uuid_scheme {
-	my $self = shift;
-	my $uuid = shift;
-
-		if ($self->version($uuid) <= 3) {
-			$self->uuid_scheme(1);
-		} else {
-			$self->uuid_scheme(2);
-		}
-
-	}
-
-=head1 NAME
-
-Prophet::UUIDGenerator
-
-=head1 METHODS
-
-=head1 DESCRIPTION
+=head2 version
 
 =cut
 
-=head1 METHODS
+sub version {
+    my $self = shift;
+    my $uuid = shift;
+    return version_of_uuid($uuid);
+}
 
-=cut
+=head2 set_uuid_scheme
 
+=cut
 
+sub set_uuid_scheme {
+    my $self = shift;
+    my $uuid = shift;
 
+    if ( $self->version($uuid) <= 3 ) {
+        $self->uuid_scheme(1);
+    } else {
+        $self->uuid_scheme(2);
+    }
+}
 
 __PACKAGE__->meta->make_immutable;
 no Any::Moose;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list