Changeset 3016
- Timestamp:
- Jan 14, 2005, 6:02:12 PM (22 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
Nebulous-Server/docs/database_setup.txt (modified) (5 diffs)
-
Nebulous-Server/lib/Nebulous/Server/SQL.pm (modified) (3 diffs)
-
Nebulous-Server/t/09_server_stat_object.t (modified) (4 diffs)
-
Nebulous-Server/t/23_client_stat.t (modified) (5 diffs)
-
Nebulous/docs/database_setup.txt (modified) (5 diffs)
-
Nebulous/lib/Nebulous/Server/SQL.pm (modified) (3 diffs)
-
Nebulous/t/09_server_stat_object.t (modified) (4 diffs)
-
Nebulous/t/23_client_stat.t (modified) (5 diffs)
-
Nebulous/t/Test/Nebulous.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/docs/database_setup.txt
r3015 r3016 1 1 # Copyright (C) 2004 Joshua Hoblitt 2 2 # 3 # $Id: database_setup.txt,v 1. 2 2005-01-15 03:29:58jhoblitt Exp $3 # $Id: database_setup.txt,v 1.3 2005-01-15 04:02:12 jhoblitt Exp $ 4 4 5 5 ### Database Setup … … 18 18 USE pixel; 19 19 20 ### MySQL 4. 020 ### MySQL 4.1 21 21 22 22 DROP TABLE IF EXISTS storage_object; … … 28 28 read_lock TINYINT DEFAULT 0 NOT NULL, 29 29 write_lock ENUM( 'write' ), 30 epoch TIMESTAMP NOT NULL, 30 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 31 mtime TIMESTAMP, 31 32 PRIMARY KEY(so_id), 32 33 KEY(ext_id(64)), … … 39 40 so_id BIGINT NOT NULL, 40 41 uri VARCHAR(255) BINARY NOT NULL, 41 sha1sum CHAR(40) ,42 sha1sum CHAR(40) ASCII, 42 43 assigned_location BOOL, 43 epoch TIMESTAMP NOT NULL,44 atime TIMESTAMP NOT NULL,44 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 45 mtime TIMESTAMP, 45 46 PRIMARY KEY(ins_id), 46 47 KEY(so_id), … … 72 73 key(class_id) 73 74 ) ENGINE=innodb; 74 75 ### MySQL 4.176 77 DROP TABLE IF EXISTS storage_object;78 CREATE TABLE storage_object (79 so_id BIGINT NOT NULL AUTO_INCREMENT,80 ext_id VARCHAR(255) UNIQUE BINARY NOT NULL,81 comment VARCHAR(255),82 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP,83 PRIMARY KEY(so_id),84 KEY(ext_id(20))85 ) ENGINE=innodb;86 87 88 DROP TABLE IF EXISTS instance;89 CREATE TABLE instance (90 ins_id BIGINT NOT NULL AUTO_INCREMENT,91 so_id BIGINT NOT NULL,92 uri VARCHAR(255) BINARY NOT NULL,93 sha1sum CHAR(40) ASCII,94 read_lock TINYINT NOT NULL,95 write_lock ENUM( 'write', 'wait' ),96 atime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,97 PRIMARY KEY(ins_id),98 KEY(so_id)99 ) ENGINE=innodb;100 101 DROP TABLE IF EXISTS lock_record;102 CREATE TABLE lock_record (103 ins_id BIGINT NOT NULL,104 type ENUM( 'read', 'write', 'wait' ) NOT NULL,105 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP106 ) ENGINE=innodb;107 108 epoch TIMESTAMP,109 75 110 76 ### Initialization -
trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r2902 r3016 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1. 3 2005-01-05 03:19:12 jhoblitt Exp $3 # $Id: SQL.pm,v 1.4 2005-01-15 04:02:12 jhoblitt Exp $ 4 4 5 5 package PS::IPP::IData::Server::SQL; … … 24 24 new_object => qq{ 25 25 INSERT INTO storage_object 26 VALUES (NULL, ?, ?, ?, 0, NULL, NULL) 26 (so_id, ext_id, class_id, comment, read_lock, write_lock) 27 VALUES (NULL, ?, ?, ?, 0, NULL) 27 28 }, 28 29 delete_object => qq{ … … 39 40 }, 40 41 get_object => qq{ 41 SELECT *42 SELECT so_id, ext_id, class_id, comment, read_lock, write_lock, epoch, mtime 42 43 FROM storage_object 43 44 WHERE ext_id = ? -
trunk/Nebulous-Server/t/09_server_stat_object.t
r2872 r3016 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 09_server_stat_object.t,v 1. 3 2005-01-03 23:55:29jhoblitt Exp $5 # $Id: 09_server_stat_object.t,v 1.4 2005-01-15 04:02:12 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 1 2;10 use Test::More tests => 13; 11 11 12 12 use lib qw( ./t ./lib ); … … 31 31 my $info = $idata->stat_object( "foo" ); 32 32 33 is( scalar @$info, 7, "number of columns" );33 is( scalar @$info, 8, "number of columns" ); 34 34 } 35 35 … … 41 41 my $info = $idata->stat_object( "foo" ); 42 42 43 is( scalar @$info, 7, "number of columns" );43 is( scalar @$info, 8, "number of columns" ); 44 44 is( @$info[0], 1, "so_id" ); 45 45 is( @$info[1], "foo", "ext_id" ); … … 49 49 is( @$info[5], undef, "write lock" ); 50 50 like( @$info[6], qr/....-..-.. ..:..:../, "epoch" ); 51 like( @$info[6], qr/....-..-.. ..:..:../, "mtime" ); 51 52 } 52 53 -
trunk/Nebulous-Server/t/23_client_stat.t
r2893 r3016 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 23_client_stat.t,v 1. 1 2005-01-04 22:02:43jhoblitt Exp $5 # $Id: 23_client_stat.t,v 1.2 2005-01-15 04:02:12 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 1 2;12 plan tests => 13; 13 13 14 14 use lib qw( ./t ./lib ); … … 30 30 my $info = $idata->stat( "foo" ); 31 31 32 is( scalar @$info, 7, "number of columns" );32 is( scalar @$info, 8, "number of columns" ); 33 33 } 34 34 … … 43 43 my $info = $idata->stat( "foo" ); 44 44 45 is( scalar @$info, 7, "number of columns" );45 is( scalar @$info, 8, "number of columns" ); 46 46 is( @$info[0], 1, "so_id" ); 47 47 is( @$info[1], "foo", "ext_id" ); … … 51 51 is( @$info[5], undef, "write lock" ); 52 52 like( @$info[6], qr/....-..-.. ..:..:../, "epoch" ); 53 like( @$info[6], qr/....-..-.. ..:..:../, "mtime" ); 53 54 } 54 55 -
trunk/Nebulous/docs/database_setup.txt
r3015 r3016 1 1 # Copyright (C) 2004 Joshua Hoblitt 2 2 # 3 # $Id: database_setup.txt,v 1. 2 2005-01-15 03:29:58jhoblitt Exp $3 # $Id: database_setup.txt,v 1.3 2005-01-15 04:02:12 jhoblitt Exp $ 4 4 5 5 ### Database Setup … … 18 18 USE pixel; 19 19 20 ### MySQL 4. 020 ### MySQL 4.1 21 21 22 22 DROP TABLE IF EXISTS storage_object; … … 28 28 read_lock TINYINT DEFAULT 0 NOT NULL, 29 29 write_lock ENUM( 'write' ), 30 epoch TIMESTAMP NOT NULL, 30 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 31 mtime TIMESTAMP, 31 32 PRIMARY KEY(so_id), 32 33 KEY(ext_id(64)), … … 39 40 so_id BIGINT NOT NULL, 40 41 uri VARCHAR(255) BINARY NOT NULL, 41 sha1sum CHAR(40) ,42 sha1sum CHAR(40) ASCII, 42 43 assigned_location BOOL, 43 epoch TIMESTAMP NOT NULL,44 atime TIMESTAMP NOT NULL,44 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 45 mtime TIMESTAMP, 45 46 PRIMARY KEY(ins_id), 46 47 KEY(so_id), … … 72 73 key(class_id) 73 74 ) ENGINE=innodb; 74 75 ### MySQL 4.176 77 DROP TABLE IF EXISTS storage_object;78 CREATE TABLE storage_object (79 so_id BIGINT NOT NULL AUTO_INCREMENT,80 ext_id VARCHAR(255) UNIQUE BINARY NOT NULL,81 comment VARCHAR(255),82 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP,83 PRIMARY KEY(so_id),84 KEY(ext_id(20))85 ) ENGINE=innodb;86 87 88 DROP TABLE IF EXISTS instance;89 CREATE TABLE instance (90 ins_id BIGINT NOT NULL AUTO_INCREMENT,91 so_id BIGINT NOT NULL,92 uri VARCHAR(255) BINARY NOT NULL,93 sha1sum CHAR(40) ASCII,94 read_lock TINYINT NOT NULL,95 write_lock ENUM( 'write', 'wait' ),96 atime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,97 PRIMARY KEY(ins_id),98 KEY(so_id)99 ) ENGINE=innodb;100 101 DROP TABLE IF EXISTS lock_record;102 CREATE TABLE lock_record (103 ins_id BIGINT NOT NULL,104 type ENUM( 'read', 'write', 'wait' ) NOT NULL,105 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP106 ) ENGINE=innodb;107 108 epoch TIMESTAMP,109 75 110 76 ### Initialization -
trunk/Nebulous/lib/Nebulous/Server/SQL.pm
r2902 r3016 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1. 3 2005-01-05 03:19:12 jhoblitt Exp $3 # $Id: SQL.pm,v 1.4 2005-01-15 04:02:12 jhoblitt Exp $ 4 4 5 5 package PS::IPP::IData::Server::SQL; … … 24 24 new_object => qq{ 25 25 INSERT INTO storage_object 26 VALUES (NULL, ?, ?, ?, 0, NULL, NULL) 26 (so_id, ext_id, class_id, comment, read_lock, write_lock) 27 VALUES (NULL, ?, ?, ?, 0, NULL) 27 28 }, 28 29 delete_object => qq{ … … 39 40 }, 40 41 get_object => qq{ 41 SELECT *42 SELECT so_id, ext_id, class_id, comment, read_lock, write_lock, epoch, mtime 42 43 FROM storage_object 43 44 WHERE ext_id = ? -
trunk/Nebulous/t/09_server_stat_object.t
r2872 r3016 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 09_server_stat_object.t,v 1. 3 2005-01-03 23:55:29jhoblitt Exp $5 # $Id: 09_server_stat_object.t,v 1.4 2005-01-15 04:02:12 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 1 2;10 use Test::More tests => 13; 11 11 12 12 use lib qw( ./t ./lib ); … … 31 31 my $info = $idata->stat_object( "foo" ); 32 32 33 is( scalar @$info, 7, "number of columns" );33 is( scalar @$info, 8, "number of columns" ); 34 34 } 35 35 … … 41 41 my $info = $idata->stat_object( "foo" ); 42 42 43 is( scalar @$info, 7, "number of columns" );43 is( scalar @$info, 8, "number of columns" ); 44 44 is( @$info[0], 1, "so_id" ); 45 45 is( @$info[1], "foo", "ext_id" ); … … 49 49 is( @$info[5], undef, "write lock" ); 50 50 like( @$info[6], qr/....-..-.. ..:..:../, "epoch" ); 51 like( @$info[6], qr/....-..-.. ..:..:../, "mtime" ); 51 52 } 52 53 -
trunk/Nebulous/t/23_client_stat.t
r2893 r3016 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 23_client_stat.t,v 1. 1 2005-01-04 22:02:43jhoblitt Exp $5 # $Id: 23_client_stat.t,v 1.2 2005-01-15 04:02:12 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 1 2;12 plan tests => 13; 13 13 14 14 use lib qw( ./t ./lib ); … … 30 30 my $info = $idata->stat( "foo" ); 31 31 32 is( scalar @$info, 7, "number of columns" );32 is( scalar @$info, 8, "number of columns" ); 33 33 } 34 34 … … 43 43 my $info = $idata->stat( "foo" ); 44 44 45 is( scalar @$info, 7, "number of columns" );45 is( scalar @$info, 8, "number of columns" ); 46 46 is( @$info[0], 1, "so_id" ); 47 47 is( @$info[1], "foo", "ext_id" ); … … 51 51 is( @$info[5], undef, "write lock" ); 52 52 like( @$info[6], qr/....-..-.. ..:..:../, "epoch" ); 53 like( @$info[6], qr/....-..-.. ..:..:../, "mtime" ); 53 54 } 54 55 -
trunk/Nebulous/t/Test/Nebulous.pm
r2785 r3016 1 1 # Copyright (C) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Nebulous.pm,v 1. 1.1.1 2004-12-22 02:16:23jhoblitt Exp $3 # $Id: Nebulous.pm,v 1.2 2005-01-15 04:02:12 jhoblitt Exp $ 4 4 5 5 package Test::IData; … … 68 68 read_lock TINYINT DEFAULT 0 NOT NULL, 69 69 write_lock ENUM( 'write' ), 70 epoch TIMESTAMP NOT NULL, 70 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 71 mtime TIMESTAMP, 71 72 PRIMARY KEY(so_id), 72 73 KEY(ext_id(64)), … … 78 79 ins_id BIGINT NOT NULL AUTO_INCREMENT, 79 80 so_id BIGINT NOT NULL, 80 uri VARCHAR(255) BINARY NOT NULL UNIQUE,81 sha1sum CHAR(40) ,81 uri VARCHAR(255) BINARY NOT NULL, 82 sha1sum CHAR(40) ASCII, 82 83 assigned_location BOOL, 83 epoch TIMESTAMP NOT NULL,84 atime TIMESTAMP NOT NULL,84 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 85 mtime TIMESTAMP, 85 86 PRIMARY KEY(ins_id), 86 87 KEY(so_id),
Note:
See TracChangeset
for help on using the changeset viewer.
