[Bps-public-commit] Prophet branch, master, updated. 122cb200bbbcbfd53684921c43ad06a6bb8a2c47

jesse jesse at bestpractical.com
Mon Aug 17 00:11:14 EDT 2009


The branch, master has been updated
       via  122cb200bbbcbfd53684921c43ad06a6bb8a2c47 (commit)
       via  68f3596fd4dd2630daf9e08d81f1e3dcfcefb074 (commit)
      from  8c96104a84409ea11a4ff2bb9cf6e54c0328d30b (commit)

Summary of changes:
 lib/Prophet/FilesystemReplica.pm |    2 +-
 lib/Prophet/Replica.pm           |   23 +++++++++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 68f3596fd4dd2630daf9e08d81f1e3dcfcefb074
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Aug 17 00:10:12 2009 -0400

    slightly better existence check for fs based replicas

diff --git a/lib/Prophet/FilesystemReplica.pm b/lib/Prophet/FilesystemReplica.pm
index 362e39a..79f3588 100644
--- a/lib/Prophet/FilesystemReplica.pm
+++ b/lib/Prophet/FilesystemReplica.pm
@@ -25,7 +25,7 @@ Returns false otherwise.
 
 sub replica_exists {
     my $self = shift;
-    return $self->_replica_version ? 1 : 0;
+    return ( $self->_file_exists('replica-version')) ? 1 : 0;
 }
 
 sub can_initialize {

commit 122cb200bbbcbfd53684921c43ad06a6bb8a2c47
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Aug 17 00:10:54 2009 -0400

    All the work for the great UUID changeover is set. now we just need to
    wait for an unbroken UUID::Tiny

diff --git a/lib/Prophet/Replica.pm b/lib/Prophet/Replica.pm
index 53c3f19..2870907 100644
--- a/lib/Prophet/Replica.pm
+++ b/lib/Prophet/Replica.pm
@@ -55,9 +55,15 @@ has after_initialize => (
 
 
 has uuid_generator => (
-    is => 'rw',
-    isa => 'Prophet::UUIDGenerator',
-    default => sub { Prophet::UUIDGenerator->new( uuid_scheme => 1) }
+    is      => 'rw',
+    isa     => 'Prophet::UUIDGenerator',
+	lazy    => 1,
+    default => sub {
+        my $self = shift;
+        my $ug = Prophet::UUIDGenerator->new( uuid_scheme => 1 );
+        return $ug;
+
+    }
 );
 
 
@@ -95,10 +101,17 @@ sub get_handle {
     }
 
     Prophet::App->require($new_class);
-    $new_class->new(%args);
+	my $handle = $new_class->new(%args);
+   
+	if ($handle->replica_exists && $handle->db_uuid) {
+		$handle->uuid_generator->set_uuid_scheme($handle->db_uuid);
+	}	
+
+   return $handle;	
 }
 
 
+
 sub initialize {
     my $self = shift;
     my %args = validate(
@@ -125,6 +138,8 @@ sub initialize {
 
     return undef if $self->replica_exists;
 
+	$self->uuid_generator->set_uuid_scheme($args{'db_uuid'}) if ($args{db_uuid});
+
     for ( $self->_on_initialize_create_paths ) {
         mkpath( [ File::Spec->catdir( $self->fs_root => $_ ) ] );
     }

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



More information about the Bps-public-commit mailing list