-- Table definitions for Trafodion Foundation configuration database
--
-- @@@ START COPYRIGHT @@@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements.  See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership.  The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License.  You may obtain a copy of the License at
--
--   http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied.  See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
-- @@@ END COPYRIGHT @@@
--

pragma synchronous = OFF;

--
-- Node tables
--

-- Physical Node (gensq.pl)
create table pnode
(
   pNid         integer  primary key,
   nodeName     varchar(128),
   excFirstCore integer,
   excLastCore  integer
);

-- Logical Node (gensq.pl)
create table lnode
(
   lNid        integer  primary key,
   pNid        integer,  -- currently generated in sqnode.pm:genConfig
   processors  integer,
   roles       integer,  -- bit map of roles
   firstCore   integer,
   lastCore    integer
);

-- Spare Node (gensq.pl)
create table snode
(
   pNid        integer,  -- currently from sqnode.pm:genConfig
   nodeName    varchar(128),
   firstCore   integer,
   lastCore    integer,
   spNid       integer,  -- physical node for which the pNid can be a spare
   primary key (pNid, spNid)
);

--
-- Registry tables
--

-- Process Name registry entry (monitor)
create table monRegProcName
(
   procId      integer primary key autoincrement,
   procName    varchar(64) unique
);

-- registry key name (monitor gensq.pl)
create table monRegKeyName
(
   keyId       integer primary key autoincrement,
   keyname     varchar(64) unique
);

-- Process Scope registry entry (monitor gensq.pl)
create table monRegProcData
(
   procId      integer,
   keyId       integer,
   dataValue   varchar (4096),
   primary key (procId, keyId)
);

-- Cluster registry entries (monitor gensq.pl)
create table monRegClusterData
(
   keyId       integer primary key,
   dataValue   varchar (4096)
);

-- Unique String (monitor)
-- Stores unique string id (nid,id)
-- The string id is passed on cluster state exchanges across after the first
-- exchange. This was to reduce the amount of data moved around in the
-- monitor sync cycles.
create table monRegUniqueStrings
(
   nid         integer,
   id          integer,
   dataValue   varchar (4096),
   primary key ( nid, id )
);

-- Persist Data (monitor gensq.pl)
create table monRegPersistData
(
   keyName     varchar(64) primary key,
   valueName   varchar(4096)
);

