Index: /trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 5486)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 5487)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.11 2005-11-05 02:35:45 jhoblitt Exp $
+# $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -590,7 +590,9 @@
             my $rows = $query->execute( $so_id );
 
-            # if we affected something other then one row something very bad has happened
-            unless ( $rows == 1 ) {
-                $log->logdie( "affected row count is $rows instead of 1" );
+            # if we affected something other then two rows something very bad
+            # has happened
+            # this will have to be changed in order to support hardlinks
+            unless ( $rows == 2 ) {
+                $log->logdie( "affected row count is $rows instead of 2" );
             }
         }
Index: /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 5486)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 5487)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.11 2005-11-05 03:26:07 jhoblitt Exp $
+# $Id: SQL.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -24,6 +24,6 @@
     new_object          => qq{
         INSERT INTO storage_object
-        (so_id, ext_id)
-        VALUES (?, ?)
+        (so_id, ext_id, type)
+        VALUES (?, ?, 'REG_FILE')
     },
     new_object_attr  => qq{
@@ -33,6 +33,8 @@
     },
     delete_object       => qq{
-        DELETE FROM storage_object, storage_object_attr
-        WHERE so_id = ?
+        DELETE storage_object, storage_object_attr 
+        FROM storage_object LEFT JOIN storage_object_attr
+        USING (so_id)
+        WHERE storage_object.so_id = ?
     },
     new_object_instance  => qq{
@@ -52,4 +54,5 @@
         WHERE ext_id = ?
     },
+    # Note: this sets an update lock
     get_object_locks    => qq{
         SELECT storage_object.so_id,
@@ -139,4 +142,5 @@
     my @clear = split /;/, <<END;
 DROP TABLE IF EXISTS storage_object;
+DROP TABLE IF EXISTS storage_object_attr;
 DROP TABLE IF EXISTS instance;
 DROP TABLE IF EXISTS lock_record;
@@ -163,13 +167,13 @@
 
 __DATA__
-DROP TABLE IF EXISTS storage_object;
 CREATE TABLE storage_object (
     so_id BIGINT NOT NULL AUTO_INCREMENT,
     ext_id VARCHAR(255) BINARY NOT NULL UNIQUE,
+    type enum('REG_FILE'),
     PRIMARY KEY(so_id),
-    KEY(ext_id(64))
-) ENGINE=innodb;
-
-DROP TABLE IF EXISTS storage_object_attr ;
+    KEY(ext_id(64)),
+    KEY(type)
+) ENGINE=innodb;
+
 CREATE TABLE storage_object_attr (
     so_id BIGINT NOT NULL AUTO_INCREMENT,
Index: /trunk/Nebulous/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 5486)
+++ /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 5487)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.11 2005-11-05 02:35:45 jhoblitt Exp $
+# $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -590,7 +590,9 @@
             my $rows = $query->execute( $so_id );
 
-            # if we affected something other then one row something very bad has happened
-            unless ( $rows == 1 ) {
-                $log->logdie( "affected row count is $rows instead of 1" );
+            # if we affected something other then two rows something very bad
+            # has happened
+            # this will have to be changed in order to support hardlinks
+            unless ( $rows == 2 ) {
+                $log->logdie( "affected row count is $rows instead of 2" );
             }
         }
Index: /trunk/Nebulous/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 5486)
+++ /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 5487)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.11 2005-11-05 03:26:07 jhoblitt Exp $
+# $Id: SQL.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -24,6 +24,6 @@
     new_object          => qq{
         INSERT INTO storage_object
-        (so_id, ext_id)
-        VALUES (?, ?)
+        (so_id, ext_id, type)
+        VALUES (?, ?, 'REG_FILE')
     },
     new_object_attr  => qq{
@@ -33,6 +33,8 @@
     },
     delete_object       => qq{
-        DELETE FROM storage_object, storage_object_attr
-        WHERE so_id = ?
+        DELETE storage_object, storage_object_attr 
+        FROM storage_object LEFT JOIN storage_object_attr
+        USING (so_id)
+        WHERE storage_object.so_id = ?
     },
     new_object_instance  => qq{
@@ -52,4 +54,5 @@
         WHERE ext_id = ?
     },
+    # Note: this sets an update lock
     get_object_locks    => qq{
         SELECT storage_object.so_id,
@@ -139,4 +142,5 @@
     my @clear = split /;/, <<END;
 DROP TABLE IF EXISTS storage_object;
+DROP TABLE IF EXISTS storage_object_attr;
 DROP TABLE IF EXISTS instance;
 DROP TABLE IF EXISTS lock_record;
@@ -163,13 +167,13 @@
 
 __DATA__
-DROP TABLE IF EXISTS storage_object;
 CREATE TABLE storage_object (
     so_id BIGINT NOT NULL AUTO_INCREMENT,
     ext_id VARCHAR(255) BINARY NOT NULL UNIQUE,
+    type enum('REG_FILE'),
     PRIMARY KEY(so_id),
-    KEY(ext_id(64))
-) ENGINE=innodb;
-
-DROP TABLE IF EXISTS storage_object_attr ;
+    KEY(ext_id(64)),
+    KEY(type)
+) ENGINE=innodb;
+
 CREATE TABLE storage_object_attr (
     so_id BIGINT NOT NULL AUTO_INCREMENT,
