Index: /branches/neb_distrib_20081210/Nebulous-Server/Changes
===================================================================
--- /branches/neb_distrib_20081210/Nebulous-Server/Changes	(revision 23726)
+++ /branches/neb_distrib_20081210/Nebulous-Server/Changes	(revision 23727)
@@ -10,4 +10,6 @@
     - rename Nebulous::Keys class -> Nebulous::Key
     - select neb db to use by hashing only the directory component of the key
+    - disallow Nebulous::Server->rename_object() when it would cause the db
+      hash of a key to change
       
 0.16
Index: /branches/neb_distrib_20081210/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- /branches/neb_distrib_20081210/Nebulous-Server/lib/Nebulous/Server.pm	(revision 23726)
+++ /branches/neb_distrib_20081210/Nebulous-Server/lib/Nebulous/Server.pm	(revision 23727)
@@ -326,4 +326,9 @@
     $log->debug("entered - @_");
 
+    unless ($self->_db_index_for_key($key)
+         == $self->_db_index_for_key($newkey)) {
+        $log->logdie("can not rename objects across distributed database boundaries");
+    }
+
 TRANS: while (1) {
         eval {
Index: /branches/neb_distrib_20081210/Nebulous-Server/t/13_server_rename_object.t
===================================================================
--- /branches/neb_distrib_20081210/Nebulous-Server/t/13_server_rename_object.t	(revision 23726)
+++ /branches/neb_distrib_20081210/Nebulous-Server/t/13_server_rename_object.t	(revision 23727)
@@ -8,5 +8,5 @@
 use warnings FATAL => qw( all );
 
-use Test::More tests => 6;
+use Test::More tests => 7;
 
 use lib qw( ./t ./lib );
@@ -73,3 +73,19 @@
 like($@, qr/2 were expected/, "too many params");
 
+# test attempting to rename a key in such a way to cause the distributed
+# storage db to change
+# this must be the last test as we're messing with the $neb object
+eval {
+    $neb->config->add_db(
+        dbindex     => 1,
+        dsn         => $NEB_DB,
+        dbuser      => $NEB_USER,
+        dbpasswd    => $NEB_PASS,
+    );
+
+    $neb->create_object("a/foo");
+    $neb->rename_object("a/foo", "g/bar");
+};
+like($@, qr/rename objects across distributed database boundaries/, "rename between databases");
+
 Test::Nebulous->cleanup;
