[Bps-public-commit] r12374 - in Prophet/branches/luid: lib/Prophet
sartak at bestpractical.com
sartak at bestpractical.com
Fri May 16 05:38:45 EDT 2008
Author: sartak
Date: Fri May 16 05:38:41 2008
New Revision: 12374
Modified:
Prophet/branches/luid/ (props changed)
Prophet/branches/luid/lib/Prophet/Replica.pm
Log:
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/branches/luid/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/branches/luid/lib/Prophet/Replica.pm (original)
+++ Prophet/branches/luid/lib/Prophet/Replica.pm Fri May 16 05:38:41 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