[Bps-public-commit] r11545 - in SVN-PropDB/lib/Prophet: .
clkao at bestpractical.com
clkao at bestpractical.com
Sat Apr 5 18:36:34 EDT 2008
Author: clkao
Date: Sat Apr 5 18:36:30 2008
New Revision: 11545
Modified:
SVN-PropDB/lib/Prophet/ForeignReplica.pm
SVN-PropDB/lib/Prophet/Replica.pm
SVN-PropDB/lib/Prophet/Replica/SVN.pm
Log:
move last_changeset_from_source back to ::replica , now
it always looks at merge tickets on state_handle.
Modified: SVN-PropDB/lib/Prophet/ForeignReplica.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/ForeignReplica.pm (original)
+++ SVN-PropDB/lib/Prophet/ForeignReplica.pm Sat Apr 5 18:36:30 2008
@@ -30,41 +30,19 @@
}
-
-
-my $SOURCE_CACHE = App::Cache->new( { ttl => 60 * 60 } ); # la la la
-# "Remote bookkeeping merge tickets."
-# recording a merge ticket locally on behalf of the source ($self)
-# Prophet::Record type '_remote_merge_tickets'?
-
-sub record_changeset_integration {
- my ( $self, $source_uuid, $source_seq ) = @_;
- return $SOURCE_CACHE->set( $self->uuid . '-' . $source_uuid => $source_seq );
-}
-
-=head2 last_changeset_from_source $SOURCE_UUID
-
-Returns the last changeset id seen from the source identified by $SOURCE_UUID
-
-=cut
-
-sub last_changeset_from_source {
- my $self = shift;
- my ($source_uuid) = validate_pos( @_, { type => SCALAR } );
- return $SOURCE_CACHE->get( $self->uuid . '-' . $source_uuid ) || 0;
-}
-
-
-
-
sub record_integration_changeset {
warn "record_integration_changeset should be renamed to 'record_original_change";
my ( $self, $changeset ) = @_;
$self->record_changeset($changeset);
+ # XXX: this can now be back in the base class and always record in state_handle sanely
# does the merge ticket recording & _source_metadata (book keeping for what txns in rt we just created)
- $self->record_changeset_integration( $changeset->original_source_uuid, $changeset->original_sequence_no );
+ $self->state_handle->begin_edit;
+ $self->state_handle->record_changeset_integration($changeset);
+ $self->state_handle->commit_edit;
+
+ return;
}
Modified: SVN-PropDB/lib/Prophet/Replica.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica.pm (original)
+++ SVN-PropDB/lib/Prophet/Replica.pm Sat Apr 5 18:36:30 2008
@@ -207,6 +207,38 @@
die ref( $_[0] ) . ' must implement record_changeset';
}
+
+=head2 last_changeset_from_source $SOURCE_UUID
+
+Returns the last changeset id seen from the source identified by $SOURCE_UUID
+
+=cut
+
+sub last_changeset_from_source {
+ my $self = shift;
+ my ($source) = validate_pos( @_, { type => SCALAR } );
+
+ return $self->state_handle->_retrieve_metadata_for( $Prophet::Handle::MERGETICKET_METATYPE, $source, 'last-changeset' ) || 0;
+
+ # the code below is attempting to get the content over ra so we
+ # can deal with remote svn repo. however this also assuming the
+ # remote is having the same prophet_handle->db_root (which is
+ # always empty for now.) the code to handle remote svn should be
+ # actually abstracted along when we design the sync prototype
+
+ my ( $stream, $pool );
+
+ my $filename = join( "/", $self->prophet_handle->db_root, $Prophet::Handle::MERGETICKET_METATYPE, $source );
+ my ( $rev_fetched, $props )
+ = eval { $self->ra->get_file( $filename, $self->ra->get_latest_revnum, $stream, $pool ); };
+
+ # XXX TODO this is hacky as hell and violates abstraction barriers in the name of doing things over the RA
+ # because we want to be able to sync to a remote replica someday.
+
+ return ( $props->{'last-changeset'} || 0 );
+
+}
+
=head2 accepts_changesets
Returns true if this source is one we know how to write to (and have permission to write to)
Modified: SVN-PropDB/lib/Prophet/Replica/SVN.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica/SVN.pm (original)
+++ SVN-PropDB/lib/Prophet/Replica/SVN.pm Sat Apr 5 18:36:30 2008
@@ -145,37 +145,6 @@
return $changeset;
}
-=head2 last_changeset_from_source $SOURCE_UUID
-
-Returns the last changeset id seen from the source identified by $SOURCE_UUID
-
-=cut
-
-sub last_changeset_from_source {
- my $self = shift;
- my ($source) = validate_pos( @_, { type => SCALAR } );
-
- return $self->prophet_handle->_retrieve_metadata_for( $Prophet::Handle::MERGETICKET_METATYPE, $source, 'last-changeset' ) || 0;
-
- # the code below is attempting to get the content over ra so we
- # can deal with remote svn repo. however this also assuming the
- # remote is having the same prophet_handle->db_root (which is
- # always empty for now.) the code to handle remote svn should be
- # actually abstracted along when we design the sync prototype
-
- my ( $stream, $pool );
-
- my $filename = join( "/", $self->prophet_handle->db_root, $Prophet::Handle::MERGETICKET_METATYPE, $source );
- my ( $rev_fetched, $props )
- = eval { $self->ra->get_file( $filename, $self->ra->get_latest_revnum, $stream, $pool ); };
-
- # XXX TODO this is hacky as hell and violates abstraction barriers in the name of doing things over the RA
- # because we want to be able to sync to a remote replica someday.
-
- return ( $props->{'last-changeset'} || 0 );
-
-}
-
sub record_integration_changeset {
my $self = shift;
$self->prophet_handle->integrate_changeset(@_);
More information about the Bps-public-commit
mailing list