[Bps-public-commit] r12440 - in Prophet/trunk: .

jesse at bestpractical.com jesse at bestpractical.com
Sat May 17 05:31:10 EDT 2008


Author: jesse
Date: Sat May 17 05:31:08 2008
New Revision: 12440

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Replica.pm

Log:
 r31105 at dhcp113 (orig r12374):  sartak | 2008-05-16 18:38:41 +0900
  r55964 at onn:  sartak | 2008-05-16 05:38:33 -0400
  Record->find_uuid_by_luid which just uses the reverse of the uuid->luid mapping
 


Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Sat May 17 05:31:08 2008
@@ -508,6 +508,20 @@
     return $mapping->{ $args{'uuid'} };
 }
 
+=head2 find_uuid_by_luid { luid => LUID }
+
+Finds the UUID for the given LUID. Returns C<undef> if the LUID is not known.
+
+=cut
+
+sub find_uuid_by_luid {
+    my $self = shift;
+    my %args = validate( @_, { luid => 1 } );
+
+    my $mapping = $self->_read_luid2guid_mappings;
+    return $mapping->{ $args{'luid'} };
+}
+
 sub _create_luid {
     my $self = shift;
     my $map  = shift;
@@ -523,6 +537,13 @@
     Carp::confess "Someone has failed to implement a '_write_guid2luid_mappings' method for their replica type.";
 }
 
+sub _read_luid2guid_mappings {
+    my $self = shift;
+    my $guid2luid = $self->_read_luid2guid_mappings(@_);
+    my %luid2guid = reverse %$guid2luid;
+    return \%luid2guid;
+}
+
 =head2 traverse_changesets { after => SEQUENCE_NO, callback => sub {} }
 
 Walk through each changeset in the replica after SEQUENCE_NO, calling the C<callback> for each one in turn.



More information about the Bps-public-commit mailing list