--
-- SQL Table Definitions for CRAM DPE
--	This version is tuned for PostgresSQL
--	stp@create.ucsb.edu -- 2003.08.03
--

-- List of tables of networks

DROP TABLE nets;
CREATE TABLE nets (
	id serial,				name TEXT
);

-- The Network Node/Machine Table; there can be several tables derived from this for different networks

DROP TABLE ridl;
DROP TABLE create_net;

DROP TABLE network;
CREATE TABLE network (
	id serial,				status TEXT,
	name TEXT,				fullname TEXT,
	l_port INT,				e_port INT,
-- Performance
	MIPS SMALLINT,			MFLOPS SMALLINT,
	latency SMALLINT,		jitter SMALLINT,
-- Hardware
	sound TEXT CHECK (sound in ('None', 'Stereo', 'Multi_chan', 'Other')),
	graphics TEXT CHECK (graphics in ('None', 'Screen', 'Camera', 'HMD', 'Other')),
	haptic TEXT CHECK (haptic in ('None', 'Glove', 'Tracker', 'Mouse', 'MIDI', 'Other')),
	network TEXT CHECK (network in ('E10', 'E100', 'E1000', 'Other')),
	processor TEXT CHECK (processor in('SPARC', 'X86', 'MIPS', 'PowerPC', 'Other')),
-- Software
	OS TEXT CHECK (OS in ('Solaris', 'IRIX', 'Linux', 'MacOSX', 'Windows', 'Other'))
);

-- Service Type Table

DROP TABLE svctypes;
CREATE TABLE svctypes (
	id serial,				name TEXT,
	command TEXT,			arguments TEXT,
	options TEXT[],
-- Requirements
	MIPS SMALLINT,			MFLOPS SMALLINT,
	latency SMALLINT,		jitter SMALLINT,
	sound TEXT [],			graphics TEXT [],
	haptic TEXT [],			network TEXT [],
	processor TEXT [],		OS TEXT []
);

-- Service Table

DROP TABLE services;
CREATE TABLE services (
	id serial,				name TEXT,			
	type TEXT,				command TEXT,
	arguments TEXT[],		options TEXT,
	node TEXT
);

-- Applications Table

DROP TABLE applications;
CREATE TABLE applications (
	id serial,
	name TEXT,
	
-- the services that comprise the application, in (Node.Service) notation
	services TEXT[]
);

