IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23727


Ignore:
Timestamp:
Apr 7, 2009, 2:03:39 PM (17 years ago)
Author:
jhoblitt
Message:

disallow Nebulous::Server->rename_object() when it would cause the db hash of a key to change

Location:
branches/neb_distrib_20081210/Nebulous-Server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/neb_distrib_20081210/Nebulous-Server/Changes

    r23725 r23727  
    1010    - rename Nebulous::Keys class -> Nebulous::Key
    1111    - select neb db to use by hashing only the directory component of the key
     12    - disallow Nebulous::Server->rename_object() when it would cause the db
     13      hash of a key to change
    1214     
    13150.16
  • branches/neb_distrib_20081210/Nebulous-Server/lib/Nebulous/Server.pm

    r23726 r23727  
    326326    $log->debug("entered - @_");
    327327
     328    unless ($self->_db_index_for_key($key)
     329         == $self->_db_index_for_key($newkey)) {
     330        $log->logdie("can not rename objects across distributed database boundaries");
     331    }
     332
    328333TRANS: while (1) {
    329334        eval {
  • branches/neb_distrib_20081210/Nebulous-Server/t/13_server_rename_object.t

    r17717 r23727  
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 6;
     10use Test::More tests => 7;
    1111
    1212use lib qw( ./t ./lib );
     
    7373like($@, qr/2 were expected/, "too many params");
    7474
     75# test attempting to rename a key in such a way to cause the distributed
     76# storage db to change
     77# this must be the last test as we're messing with the $neb object
     78eval {
     79    $neb->config->add_db(
     80        dbindex     => 1,
     81        dsn         => $NEB_DB,
     82        dbuser      => $NEB_USER,
     83        dbpasswd    => $NEB_PASS,
     84    );
     85
     86    $neb->create_object("a/foo");
     87    $neb->rename_object("a/foo", "g/bar");
     88};
     89like($@, qr/rename objects across distributed database boundaries/, "rename between databases");
     90
    7591Test::Nebulous->cleanup;
Note: See TracChangeset for help on using the changeset viewer.