[Bps-public-commit] r11717 - in Prophet/trunk: . lib/Prophet lib/Prophet/Replica lib/Prophet/Resolver lib/Prophet/Test

jesse at bestpractical.com jesse at bestpractical.com
Sun Apr 13 20:44:36 EDT 2008


Author: jesse
Date: Sun Apr 13 20:44:36 2008
New Revision: 11717

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/doc/glossary
   Prophet/trunk/lib/Prophet/Change.pm
   Prophet/trunk/lib/Prophet/ChangeSet.pm
   Prophet/trunk/lib/Prophet/Collection.pm
   Prophet/trunk/lib/Prophet/Conflict.pm
   Prophet/trunk/lib/Prophet/ConflictingChange.pm
   Prophet/trunk/lib/Prophet/Record.pm
   Prophet/trunk/lib/Prophet/Replica.pm
   Prophet/trunk/lib/Prophet/Replica/SVN.pm
   Prophet/trunk/lib/Prophet/Resolver/Prompt.pm
   Prophet/trunk/lib/Prophet/Test.pm
   Prophet/trunk/lib/Prophet/Test/Participant.pm

Log:
 r29647 at 31b:  jesse | 2008-04-13 19:30:17 -0400
  node->record


Modified: Prophet/trunk/doc/glossary
==============================================================================
--- Prophet/trunk/doc/glossary	(original)
+++ Prophet/trunk/doc/glossary	Sun Apr 13 20:44:36 2008
@@ -83,7 +83,7 @@
 
 =head2 Node
 
-Too many things get called nodes
+Too many things get called records
 
 =head2 revision
 

Modified: Prophet/trunk/lib/Prophet/Change.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Change.pm	(original)
+++ Prophet/trunk/lib/Prophet/Change.pm	Sun Apr 13 20:44:36 2008
@@ -6,7 +6,7 @@
 
 use Prophet::PropChange;
 use Params::Validate;
-__PACKAGE__->mk_accessors(qw/record_type node_uuid change_type resolution_cas/);
+__PACKAGE__->mk_accessors(qw/record_type record_uuid change_type resolution_cas/);
 
 =head1 NAME
 
@@ -22,7 +22,7 @@
 
 The record type for the node.
 
-=head2 node_uuid
+=head2 record_uuid
 
 The UUID of the node being changed
 
@@ -54,7 +54,7 @@
             resolution_cas => $conflict->cas_key,
             change_type    => $conflict->change_type,
             record_type      => $conflict->record_type,
-            node_uuid      => $conflict->node_uuid
+            record_uuid      => $conflict->record_uuid
         }
     );
     return $self;
@@ -100,7 +100,7 @@
     my $uuid    = shift;
     my $hashref = shift;
     my $self    = $class->new(
-        { record_type => $hashref->{'record_type'}, node_uuid => $uuid, change_type => $hashref->{'change_type'} } );
+        { record_type => $hashref->{'record_type'}, record_uuid => $uuid, change_type => $hashref->{'change_type'} } );
     foreach my $prop ( keys %{ $hashref->{'prop_changes'} } ) {
         $self->add_prop_change(
             name => $prop,

Modified: Prophet/trunk/lib/Prophet/ChangeSet.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/ChangeSet.pm	(original)
+++ Prophet/trunk/lib/Prophet/ChangeSet.pm	Sun Apr 13 20:44:36 2008
@@ -100,7 +100,7 @@
 
     for my $change ( $self->changes ) {
 
-        $as_hash->{changes}->{ $change->node_uuid } = $change->as_hash;
+        $as_hash->{changes}->{ $change->record_uuid } = $change->as_hash;
     }
     return $as_hash;
 }

Modified: Prophet/trunk/lib/Prophet/Collection.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Collection.pm	(original)
+++ Prophet/trunk/lib/Prophet/Collection.pm	Sun Apr 13 20:44:36 2008
@@ -57,11 +57,11 @@
     # find all items,
     Carp::cluck unless defined $self->type;
 
-    my $nodes = $self->handle->list_nodes( type => $self->type );
+    my $records = $self->handle->list_records( type => $self->type );
 
     # run coderef against each item;
     # if it matches, add it to _items
-    foreach my $key (@$nodes) {
+    foreach my $key (@$records) {
         my $record = $self->record_class->new( { handle => $self->handle, type => $self->type } );
         $record->load( uuid => $key );
         if ( $coderef->($record) ) {

Modified: Prophet/trunk/lib/Prophet/Conflict.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Conflict.pm	(original)
+++ Prophet/trunk/lib/Prophet/Conflict.pm	Sun Apr 13 20:44:36 2008
@@ -85,7 +85,7 @@
     my ($change) = validate_pos( @_, { isa => "Prophet::Change" } );
     my $file_op_conflict = '';
 
-    my $file_exists = $self->prophet_handle->record_exists( uuid => $change->node_uuid, type => $change->record_type );
+    my $file_exists = $self->prophet_handle->record_exists( uuid => $change->record_uuid, type => $change->record_type );
 
     # It's ok to delete a node that exists
     if ( $change->change_type eq 'delete' && !$file_exists ) {
@@ -102,7 +102,7 @@
 
     my $change_conflict = Prophet::ConflictingChange->new(
         {   record_type          => $change->record_type,
-            node_uuid          => $change->node_uuid,
+            record_uuid          => $change->record_uuid,
             target_record_exists => $file_exists,
             change_type        => $change->change_type,
             file_op_conflict   => $file_op_conflict
@@ -111,7 +111,7 @@
 
     if ($file_exists) {
         my $current_state
-            = $self->prophet_handle->get_node_props( uuid => $change->node_uuid, type => $change->record_type );
+            = $self->prophet_handle->get_record_props( uuid => $change->record_uuid, type => $change->record_type );
 
         push @{ $change_conflict->prop_conflicts }, $self->_generate_prop_change_conflicts( $change, $current_state );
     }
@@ -186,7 +186,7 @@
 
     for my $conflict ( @{ $self->conflicting_changes } ) {
         my $nullify_conflict
-            = Prophet::Change->new( { record_type => $conflict->record_type, node_uuid => $conflict->node_uuid } );
+            = Prophet::Change->new( { record_type => $conflict->record_type, record_uuid => $conflict->record_uuid } );
 
         if ( $conflict->file_op_conflict eq "delete_missing_file" ) {
             $nullify_conflict->change_type('add_file');

Modified: Prophet/trunk/lib/Prophet/ConflictingChange.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/ConflictingChange.pm	(original)
+++ Prophet/trunk/lib/Prophet/ConflictingChange.pm	Sun Apr 13 20:44:36 2008
@@ -9,7 +9,7 @@
 use Storable 'dclone';
 
 # change_type is one of: add_file add_dir update delete
-__PACKAGE__->mk_accessors(qw/record_type node_uuid source_record_exists target_record_exists change_type file_op_conflict/);
+__PACKAGE__->mk_accessors(qw/record_type record_uuid source_record_exists target_record_exists change_type file_op_conflict/);
 
 =head2 prop_conflicts
 

Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Sun Apr 13 20:44:36 2008
@@ -115,7 +115,7 @@
 
     $self->uuid($uuid);
 
-    $self->handle->create_node(
+    $self->handle->create_record(
         props => $args{'props'},
         uuid  => $self->uuid,
         type  => $self->type
@@ -170,7 +170,7 @@
 
     $self->canonicalize_props( $args{'props'} );
     $self->validate_props( $args{'props'} );
-    $self->handle->set_node_props( type => $self->type, uuid => $self->uuid, props => $args{'props'} );
+    $self->handle->set_record_props( type => $self->type, uuid => $self->uuid, props => $args{'props'} );
 }
 
 =head2 get_props
@@ -181,7 +181,7 @@
 
 sub get_props {
     my $self = shift;
-    return $self->handle->get_node_props( uuid => $self->uuid, type => $self->type );
+    return $self->handle->get_record_props( uuid => $self->uuid, type => $self->type );
 }
 
 =head2 prop $name
@@ -208,7 +208,7 @@
 sub delete_prop {
     my $self = shift;
     my %args = validate( @_, { name => 1 } );
-    $self->handle->delete_node_prop( uuid => $self->uuid, name => $args{'name'} );
+    $self->handle->delete_record_prop( uuid => $self->uuid, name => $args{'name'} );
 }
 
 =head2 delete
@@ -219,7 +219,7 @@
 
 sub delete {
     my $self = shift;
-    $self->handle->delete_node( type => $self->type, uuid => $self->uuid );
+    $self->handle->delete_record( type => $self->type, uuid => $self->uuid );
 
 }
 

Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Sun Apr 13 20:44:36 2008
@@ -352,7 +352,7 @@
     # XXX: encapsulation
     $changeset->{changes} = [
         grep { $self->is_resdb || $_->record_type ne '_prophet_resolution' }
-            grep { !( $_->record_type eq $MERGETICKET_METATYPE && $_->node_uuid eq $self->uuid ) }
+            grep { !( $_->record_type eq $MERGETICKET_METATYPE && $_->record_uuid eq $self->uuid ) }
             $changeset->changes
     ];
 }
@@ -593,7 +593,7 @@
         type => '_prophet_resolution-' . $change->resolution_cas
     );
 
-    $self->create_node(
+    $self->create_record(
         uuid  => $self->uuid,
         type  => '_prophet_resolution-' . $change->resolution_cas,
         props => {
@@ -636,12 +636,12 @@
 
     my %new_props = map { $_->name => $_->new_value } $change->prop_changes;
     if ( $change->change_type eq 'add_file' ) {
-        $self->create_node( type  => $change->record_type, uuid  => $change->node_uuid, props => \%new_props);
+        $self->create_record( type  => $change->record_type, uuid  => $change->record_uuid, props => \%new_props);
     } elsif ( $change->change_type eq 'add_dir' ) {
     } elsif ( $change->change_type eq 'update_file' ) {
-        $self->set_node_props( type  => $change->record_type, uuid  => $change->node_uuid, props => \%new_props);
+        $self->set_record_props( type  => $change->record_type, uuid  => $change->record_uuid, props => \%new_props);
     } elsif ( $change->change_type eq 'delete' ) {
-        $self->delete_node( type => $change->record_type, uuid => $change->node_uuid);
+        $self->delete_record( type => $change->record_type, uuid => $change->record_uuid);
     } else {
         Carp::confess( " I have never heard of the change type: " . $change->change_type );
     }
@@ -717,14 +717,14 @@
     my $self = shift;
     my ( $name, $source_uuid, $prop_name, $content ) = validate_pos( @_, 1, 1, 1, 1 );
 
-    my $props = eval { $self->get_node_props( uuid => $source_uuid, type => $name ) };
+    my $props = eval { $self->get_record_props( uuid => $source_uuid, type => $name ) };
 
     # XXX: do set-prop when exists, and just create new node with all props is probably better
     unless ( $props->{$prop_name} ) {
-        eval { $self->create_node( uuid => $source_uuid, type => $name, props => {} ) };
+        eval { $self->create_record( uuid => $source_uuid, type => $name, props => {} ) };
     }
 
-    $self->set_node_props(
+    $self->set_record_props(
         uuid  => $source_uuid,
         type  => $name,
         props => { $prop_name => $content }
@@ -738,7 +738,7 @@
 
 Returns this replica's UUID
 
-=head2 create_node { type => $TYPE, uuid => $uuid, props => { key-value pairs }}
+=head2 create_record { type => $TYPE, uuid => $uuid, props => { key-value pairs }}
 
 Create a new record of type C<$type> with uuid C<$uuid>  within the current replica.
 
@@ -748,13 +748,13 @@
 
 
 
-=head2 delete_node {uuid => $uuid, type => $type }
+=head2 delete_record {uuid => $uuid, type => $type }
 
 Deletes the node C<$uuid> of type C<$type> from the current replica. 
 
 Manufactures its own new edit if C<$self->current_edit> is undefined.
 
-=head2 set_node_props { uuid => $uuid, type => $type, props => {hash of kv pairs }}
+=head2 set_record_props { uuid => $uuid, type => $type, props => {hash of kv pairs }}
 
 
 Updates the record of type C<$type> with uuid C<$uuid> to set each property defined by the props hash. It does NOT alter any property not defined by the props hash.
@@ -762,13 +762,13 @@
 Manufactures its own current edit if none exists.
 
 
-=head2 get_node_props {uuid => $uuid, type => $type, root => $root }
+=head2 get_record_props {uuid => $uuid, type => $type, root => $root }
 
 Returns a hashref of all properties for the record of type $type with uuid C<$uuid>.
 
 'root' is an optional argument which you can use to pass in an alternate historical version of the replica to inspect.  Code to look at the immediately previous version of a record might look like:
 
-    $handle->get_node_props(
+    $handle->get_record_props(
         type => $record->type,
         uuid => $record->uuid,
         root => $self->repo_handle->fs->revision_root( $self->repo_handle->fs->youngest_rev - 1 )
@@ -779,18 +779,18 @@
 Returns true if the node in question exists. False otherwise
 
 
-=head2 list_nodes { type => $type }
+=head2 list_records { type => $type }
 
 Returns a reference to a list of all the records of type $type
 
-=head2 list_nodes
+=head2 list_records
 
 Returns a reference to a list of all the known types in your Prophet database
 
 
 =head2 type_exists { type => $type }
 
-Returns true if we have any nodes of type C<$type>
+Returns true if we have any records of type C<$type>
 
 
 

Modified: Prophet/trunk/lib/Prophet/Replica/SVN.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica/SVN.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica/SVN.pm	Sun Apr 13 20:44:36 2008
@@ -132,7 +132,7 @@
             my ( $prefix, $type, $record ) = ( $1, $2, $3 );
             my $change = Prophet::Change->new(
                 {   record_type   => $type,
-                    node_uuid   => $record,
+                    record_uuid   => $record,
                     change_type => $entry->{'paths'}->{$path}->{fs_operation}
                 }
             );
@@ -278,7 +278,7 @@
 
 }
 
-=head2 create_node { type => $TYPE, uuid => $uuid, props => { key-value pairs }}
+=head2 create_record { type => $TYPE, uuid => $uuid, props => { key-value pairs }}
 
 Create a new record of type C<$type> with uuid C<$uuid>  within the current replica.
 
@@ -288,7 +288,7 @@
 
 =cut
 
-sub create_node {
+sub create_record {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, props => 1, type => 1 } );
 
@@ -305,7 +305,7 @@
         # print $stream Dumper( $args{'props'} );
         close $stream;
     }
-    $self->_set_node_props(
+    $self->_set_record_props(
         uuid  => $args{uuid},
         props => $args{props},
         type  => $args{'type'}
@@ -314,7 +314,7 @@
 
 }
 
-sub _set_node_props {
+sub _set_record_props {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, props => 1, type => 1 } );
 
@@ -325,7 +325,7 @@
     }
 }
 
-=head2 delete_node {uuid => $uuid, type => $type }
+=head2 delete_record {uuid => $uuid, type => $type }
 
 Deletes the node C<$uuid> of type C<$type> from the current replica. 
 
@@ -333,7 +333,7 @@
 
 =cut
 
-sub delete_node {
+sub delete_record {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, type => 1 } );
 
@@ -345,7 +345,7 @@
     return 1;
 }
 
-=head2 set_node_props { uuid => $uuid, type => $type, props => {hash of kv pairs }}
+=head2 set_record_props { uuid => $uuid, type => $type, props => {hash of kv pairs }}
 
 
 Updates the record of type C<$type> with uuid C<$uuid> to set each property defined by the props hash. It does NOT alter any property not defined by the props hash.
@@ -354,7 +354,7 @@
 
 =cut
 
-sub set_node_props {
+sub set_record_props {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, props => 1, type => 1 } );
 
@@ -362,7 +362,7 @@
     $self->begin_edit() unless ($inside_edit);
 
     my $file = $self->_file_for( uuid => $args{uuid}, type => $args{'type'} );
-    $self->_set_node_props(
+    $self->_set_record_props(
         uuid  => $args{uuid},
         props => $args{props},
         type  => $args{'type'}
@@ -371,13 +371,13 @@
 
 }
 
-=head2 get_node_props {uuid => $uuid, type => $type, root => $root }
+=head2 get_record_props {uuid => $uuid, type => $type, root => $root }
 
 Returns a hashref of all properties for the record of type $type with uuid C<$uuid>.
 
 'root' is an optional argument which you can use to pass in an alternate historical version of the replica to inspect.  Code to look at the immediately previous version of a record might look like:
 
-    $handle->get_node_props(
+    $handle->get_record_props(
         type => $record->type,
         uuid => $record->uuid,
         root => $self->repo_handle->fs->revision_root( $self->repo_handle->fs->youngest_rev - 1 )
@@ -386,7 +386,7 @@
 
 =cut
 
-sub get_node_props {
+sub get_record_props {
     my $self = shift;
     my %args = validate( @_, { uuid => 1, type => 1, root => undef } );
     my $root = $args{'root'} || $self->current_root;
@@ -431,13 +431,13 @@
 
 }
 
-=head2 list_nodes { type => $type }
+=head2 list_records { type => $type }
 
 Returns a reference to a list of all the records of type $type
 
 =cut
 
-sub list_nodes {
+sub list_records {
     my $self = shift;
     my %args = validate( @_ => { type => 1 } );
     return [ keys %{ $self->current_root->dir_entries( $self->db_uuid . '/' . $args{type} . '/' ) } ];
@@ -457,7 +457,7 @@
 
 =head2 type_exists { type => $type }
 
-Returns true if we have any nodes of type C<$type>
+Returns true if we have any records of type C<$type>
 
 =cut
 

Modified: Prophet/trunk/lib/Prophet/Resolver/Prompt.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Resolver/Prompt.pm	(original)
+++ Prophet/trunk/lib/Prophet/Resolver/Prompt.pm	Sun Apr 13 20:44:36 2008
@@ -11,7 +11,7 @@
 
     my $resolution = Prophet::Change->new_from_conflict($conflicting_change);
     print "Oh no! There's a conflict between this replica and the one you're syncing from:\n";
-    print $conflicting_change->record_type . " " . $conflicting_change->node_uuid . "\n";
+    print $conflicting_change->record_type . " " . $conflicting_change->record_uuid . "\n";
 
     for my $prop_conflict ( @{ $conflicting_change->prop_conflicts } ) {
 

Modified: Prophet/trunk/lib/Prophet/Test.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Test.pm	(original)
+++ Prophet/trunk/lib/Prophet/Test.pm	Sun Apr 13 20:44:36 2008
@@ -302,10 +302,10 @@
     my $conflicts;
     for my $change ( @{ $conflict_obj->conflicting_changes } ) {
         $conflicts->{meta} = { original_source_uuid => $conflict_obj->changeset->original_source_uuid };
-        $conflicts->{records}->{ $change->node_uuid } = { change_type => $change->change_type, };
+        $conflicts->{records}->{ $change->record_uuid } = { change_type => $change->change_type, };
 
         for my $propchange ( @{ $change->prop_conflicts } ) {
-            $conflicts->{records}->{ $change->node_uuid }->{props}->{ $propchange->name } = {
+            $conflicts->{records}->{ $change->record_uuid }->{props}->{ $propchange->name } = {
                 source_old => $propchange->source_old_value,
                 source_new => $propchange->source_new_value,
                 target_old => $propchange->target_value

Modified: Prophet/trunk/lib/Prophet/Test/Participant.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Test/Participant.pm	(original)
+++ Prophet/trunk/lib/Prophet/Test/Participant.pm	Sun Apr 13 20:44:36 2008
@@ -140,15 +140,15 @@
 
     my $state;
 
-    my $nodes  = Prophet::Collection->new( handle => $cli->app_handle->handle, type => 'Scratch' );
+    my $records  = Prophet::Collection->new( handle => $cli->app_handle->handle, type => 'Scratch' );
     my $merges = Prophet::Collection->new( handle => $cli->app_handle->handle, type => $Prophet::Replica::MERGETICKET_METATYPE );
     my $resolutions = Prophet::Collection->new( handle => $cli->resdb_handle, type => '_prophet_resolution' );
 
-    $nodes->matching( sub       {1} );
+    $records->matching( sub       {1} );
     $resolutions->matching( sub {1} );
     $merges->matching( sub      {1} );
 
-    %{ $state->{nodes} }       = map { $_->uuid => $_->get_props } @{ $nodes->as_array_ref };
+    %{ $state->{records} }       = map { $_->uuid => $_->get_props } @{ $records->as_array_ref };
     %{ $state->{merges} }      = map { $_->uuid => $_->get_props } @{ $merges->as_array_ref };
     %{ $state->{resolutions} } = map { $_->uuid => $_->get_props } @{ $resolutions->as_array_ref };
 



More information about the Bps-public-commit mailing list