/* @lastChanged: "1999-10-20  17:41"
 
 * @filename:   gbd00
 * @purpose:    "BD_kernel_constants_and_types"
 * @release:    7.2
 * @see:        "-.-"
 *
 * @Copyright (c) 1999-2005 SAP AG"
 */
 
.tt 1 $SAP$LiveCache$GBD00$
.tt 3 $$BD_constants_and_types$$2000-11-10$
***********************************************************
.nf
 
 .nf
 
    ========== licence begin  GPL
    Copyright (c) 1999-2005 SAP AG
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end
.fo
 
 
.fo
 
Module  : BD_kernel_constants_and_types
 
Define  :
 
.CM *-END-* define --------------------------------------
 
Use     :
 
.CM *-END-* use -----------------------------------------
 
Synonym :
 
.CM *-END-* synonym -------------------------------------
 
 
Release :      Date : 2000-11-10
 
***********************************************************
 
Specification:
 
.CM *-END-* specification -------------------------------
 
***********************************************************
 
Description:
 
.CM *-END-* description ---------------------------------
 
***********************************************************
 
Structure:
 
.CM *-END-* structure -----------------------------------
 
**********************************************************
 
.CM -lll-
Code    :
 
 
CONST
      ERRTEXTREC_MXBD00          = 56;
      FDIRENTRY_MXBD00           = 44;
      NODE_HEADER_MXBD00         = 80;
      STD_FDIRENTRY_MXBD00       = 36;
      (* *)
      REC_ALIGN_BD00             = 2;
      (* *)
      (* --- bufferhandling --- *)
      (* *)
      MIN_RECORD_LEN_BD00        = cgg_rec_key_offset + 1; (* define byte *)
      (* *)
      (* --- nodehandling --- *)
      (* *)
      BODY_BEG_BD00              = NODE_HEADER_MXBD00 + 1;
      BODY_END_BD00              = PAGE_MXSP00 - PAGE_CHECK_TRAILER_MXGG00;
      MAX_BOTTOM_BD00            = BODY_END_BD00 + 1;
      FIRST_REC_INDEX_BD00       = 0;
      (* *)
      LEAF_LEVEL_BD00            = 0;
      FIRST_INDEX_LEVEL_BD00     = 1;
      SECOND_INDEX_LEVEL_BD00    = 2;
      THIRD_INDEX_LEVEL_BD00     = 3;
      MAX_LEVEL_BD00             = 5;
      MAX_BSTR_LEVEL_BD00        = 2;
      (* *)
      FULLCOVERING_BD00          = PAGE_MXSP00 - NODE_HEADER_MXBD00 - PAGE_CHECK_TRAILER_MXGG00;
      MAX_BSTR_COVERING_BD00     = FULLCOVERING_BD00;
      HALF_COVERING_BD00         = FULLCOVERING_BD00 DIV 2;
      QUATER_COVERING_BD00       = FULLCOVERING_BD00 DIV 4;
      NINETY_PERCENT_COV_BD00    = (FULLCOVERING_BD00 * 90) DIV 100;
      (* *)
      MAX_INVLISTLENGTH_BD00     = (FULLCOVERING_BD00 DIV 4) * 3;
      POINTERSIZE_BD00           = INT4_MXSP00;
      DIVISOR_POINTERSIZE_BD00   = POINTERSIZE_BD00 DIV 2; (* Shift Value For Pointersize Division *)
      MAX_POINTERINDEX_BD00      = FULLCOVERING_BD00 DIV POINTERSIZE_BD00;
      PNOS_PER_PAGE_BD00         = FULLCOVERING_BD00 DIV INT4_MXSP00;
      (* *)
      (* --- miscellaneous --- *)
      (* *)
      LOCK_TREE_EXCL_BD00        = true;
      LOCK_LEAF_EXCL_BD00        = true;
      SYNC_TREE_LOCK_BD00        = true;
      (* *)
      FILE_EXT_COR_BD00          = '.cor';
      (* *)
      MAX_NODE_SCAN_BD00         = 5;
      LWB_OF_LIST_BD00           = 1;
      UPB_OF_LIST_BD00           = 6;
      MAX_OBJ_GARB_COLL_BD00     = 64;
      MAX_VF_BUFFERS_BD00        = 128;(* see cserv.pcf *)
      MAX_FREE_QUEUE_BD00        = 5;
      cbd_cspmaxint4_mxspbuf     = MAX_INT4_SP00 - PAGE_MXSP00;
      (* cbd_cspmaxint4_mxspbuf  = 2147479551; *)
      (* *)
      NIL_RECINDEX_BD00             = -MAX_INT2_SP00;  (* must be < -1 *)
      (* *)
      MIN_LOCK_REQUEST_SEQ_NO_BD00  = 0;
      POS_OFF_DIFF_BD00             = 1; (* difference between position and offset, *)
      (*                                 i.e. pascal and c arrays                *)
 
TYPE
      tbd00_DelInvReason = (
            dirSetDeletedFlag_ebd00,
            dirRemoveDeletedFlag_ebd00,
            dirGarbageCollection_ebd00,
            dirRollback_ebd00,
            dirDeletePrimKey_ebd00);
      tbd00_PageLockMode = (
            plmLock_ebd00,
            plmLockWithSVPSync_ebd00,
            plmLockWithSVPSyncNoWait_ebd00,
            plmLockWithoutReschedule_ebd00); (* PTS 1115176 TS 2002-04-09 *)
      (* *)
      tbd_node_request = (
            nr_for_read,
            nr_for_update);
      (* *)
      tbd_lru_info = (
            lru_normal,
            lru_mid,
            lru_last);
      (* *)
      tbd_file_state_set = SET OF (
            f_unused1_ebd00, (* unloaded *)
            f_bad,
            f_read_only,
            f_not_accessible,
            f_unused2_ebd00,  (* write_off *)
            f_unused3_ebd00); (* no_tree_index *)
      (* *)
      tbd_objpage_state_set = SET OF (
            objp_no_chain_to_freelist); (* "new object" optimization *)
      (* *)
      tbd_fileinfo_desc_set = SET OF (
            fid_fill0, (* fid_user_ref *)
            fid_fill1, (* fid_new_long_col *)
            fid_fill2,
            fid_fill3,
            fid_fill4,
            fid_fill5,
            fid_fill6,
            fid_fill7);
      (* *)
 
      tbd_fileinfo = RECORD
            fi_type            : tgg00_FiletypeSet;
            fi_state           : tbd_file_state_set;
            fi_fill1           : boolean;
            fi_descr           : tbd_fileinfo_desc_set;
            fi_root            : tsp00_PageNo;
            fi_vers            : tgg91_FileVersion;
            fi_col_cnt         : tsp00_Int2;
            fi_user_ref        : tgg00_UserRef;
            fi_var_col_cnt_pos : tsp00_Int2
      END; (*filedirectory*)
 
 
      tbd00_FDirEntry = RECORD
            CASE integer OF
                1 :
                    (fdirBuf_bd00 : PACKED ARRAY [1..FDIRENTRY_MXBD00] OF char);
                2 :
                    (fdirEntryLength_bd00   : tsp00_Int2;
                    fdirFileNameLength_bd00 : tsp00_Int2;
                    fdirFill1_bd00          : tsp00_Int2;
                    fdirFill2_bd00          : tsp00_Int2;
                    fdirFileName_bd00       : tgg00_Filename;
                    fdirFileInfo_bd00       : tbd_fileinfo);
                END;
            (*ENDCASE*) 
 
 
      tbd00_FreeQueue = RECORD
            fqPnos_bd00        : ARRAY [1..MAX_FREE_QUEUE_BD00] OF tsp00_PageNo;
            fqPageVersion_bd00 : ARRAY [1..MAX_FREE_QUEUE_BD00] OF tgg00_ConverterVersion;
            fqTop_bd00         : tsp00_Int4
      END;
 
      tbd00_LockRequestSeqNo = tsp00_Int4;
      (* *)
      tbd_position_list = ARRAY [ 1..MAX_BSTR_LEVEL_BD00 ] OF tgg00_PagePos;
      (* *)
      tbd_node_header   = PACKED ARRAY [1..NODE_HEADER_MXBD00] OF char;
      (* *)
      tbd_node_body     = PACKED ARRAY [BODY_BEG_BD00..BODY_END_BD00] OF char;
      (* *)
      tbd_pointer_list  = ARRAY [1..MAX_POINTERINDEX_BD00] OF tgg00_PagePos;
      (* *)
      tbd00_ConsistencyInfo = SET OF (
            c_historyInPagingFile_ebd00,
            c_historyOnPage_ebd00 );
 
      tbd00_PageFixSizeSpace = RECORD
            filler1               : tsp00_C50;
            fixRecordLength       : tsp00_Int2;
            filler2               : tsp00_Int4;
            filler3               : tsp00_C24;
      END;
 
 
      tbd00_RedoPage = RECORD
            filler1               : tsp00_C42;
            filler2               : tsp00_Int2;
            firstEntrySequence    : tsp00_Int4;
            (* *)
            filler3               : tsp00_Int4;
            lastEntrySequence     : tsp00_Int4;
            (* *)
            filler4               : tsp00_C8;
            (* *)
            transno               : tgg91_TransNo;
            filler5               : tsp00_C10;
      END;
 
 
      tbd00_UndoPage = RECORD
            filler1               : tsp00_C50;
            filler2               : tsp00_Int2;
            lastEntrySequence     : tsp00_Int4;
            (* *)
            pagecount             : tsp00_Int4;
            relevantForGC         : boolean;
            filler3               : boolean;
            filler4               : tsp00_Int2;
            (* *)
            transno               : tgg91_TransNo;
            lastGC_offset         : tsp00_Int2;
            (* *)
            lastGC_pageno         : tsp00_PageNo;
            filler5               : tsp00_Int4;
      END;
 
 
      tbd00_OpenTransPage = RECORD
            filler1                  : tsp00_C18;
            filler2                  : boolean;
            isCreatedDuringSavepoint : boolean;
            filler5                  : tsp00_C32;
            oldestEOTSequence        : tsp00_Int4;
            filler7                  : tsp00_C16;
            savepointSequence        : tsp00_Int4;
            filler8                  : tsp00_Int4;
      END;
 
 
      tbd_node = RECORD
            CASE integer OF
                1: (* Kernel_Page72::PersistentHeader *)
                    (nd_header                 : tgg00_PageHeader);
                2: (* Data_Page *)
                    (nd_full_header            : tbd_node_header;
                    nd_body                    : tbd_node_body;
                    nd_full_trailer            : tgg00_PageCheckTrailer);
                3:
                    (nd_id                     : tsp00_PageNo;
                    nd_pt                      : tgg00_PageType;
                    nd_pt2                     : tgg00_PageType2;
                    nd_checktype               : tgg00_PageCheckType;
                    nd_pmode                   : tgg00_PageMode;
                    (* *)
                    nd_bottom                  : tgg00_PagePos; (* Data_Page *)
                    nd_record_cnt              : tsp00_Int4;
                    (* *)
                    nd_level                   : tsp00_Int2;
                    nd_file_state              : tbd_file_state_set;
                    nd_sorted                  : boolean;
                    nd_root                    : tsp00_PageNo;
                    (* *)
                    nd_right                   : tsp00_PageNo; (* Data_ChainPage      *)
                    nd_left                    : tsp00_PageNo; (* Data_PageSplitSpace *)
                    (* *)
                    nd_last                    : tsp00_PageNo; (* Data_ChainPage      *)
                    nd_filler2                 : tsp00_Int4;
                    (* *)
                    nd_conv_version            : tgg00_ConverterVersion;
                    nd_str_version             : tsp00_Int4;
                    (* *)
                    nd_file_version            : tgg91_FileVersion;
                    nd_history_info            : tbd00_ConsistencyInfo;
                    ndPageVersion_bd00         : tsp00_Uint1;
                    ndInvUsageCnt_bd00         : tsp00_Int4;    (* Log_UndoPage *)
                    (* *)
                    ndLeafCount_bd00           : tsp00_Int4;    (* Log_UndoPage *)
                    ndTreeLeaves_bd00          : tsp00_Int4;
                    (* *)
                    nd_trans_id                : tgg91_TransNo; (* Log_UndoPage *)
                    nd_filler4                 : tsp00_Int2;
                    (* *)
                    ndInvRoot_bd00             : tsp00_PageNo;  (* Log_UndoPage *)
                    (* PTS 1120695 UH 2003-10-27 *)
                    nd_write_cnt               : tsp00_Int4;
                    (* *)
                    nd_pointer_list            : tbd_pointer_list;
                    (* *)
                    nd_checksum                : tsp00_Int4;
                    nd_trailer                 : tgg00_PageTrailer);
                4:
                    (nd_header_space           : tsp00_C8; (* used by tfnObj_egg00 and tfnObjBefore_egg00 *)
                    (* *)
                    nd_max_obj_cnt             : tsp00_Uint2;
                    nd_occ_obj_cnt             : tsp00_Uint2;
                    nd_free_eot_obj_cnt        : tsp00_Uint2;
                    nd_free_obj_cnt            : tsp00_Uint2;
                    (* *)
                    nd_level_space             : tsp00_Int2;
                    nd_file_state_space        : tbd_file_state_set;
                    nd_objpage_state           : tbd_objpage_state_set;
                    nd_root_space              : tsp00_PageNo;
                    (* *)
                    nd_right_space             : tsp00_PageNo;
                    nd_left_space              : tsp00_PageNo;
                    (* *)
                    nd_filler5_2               : tsp00_Int2;
                    nd_in_free_chain           : boolean;
                    nd_num_key_files           : tsp00_Uint1;
                    (* PTS 1115760 2002-05-15 FF                                                 *)
                    (* ndLockRequestSeqNo_bd00 has been migrated to ndLockRequestSeqNoLow_bd00   *)
                    (* and ndLockRequestSeqNoHigh_bd00 because of the eliminated empty-list.     *)
                    ndLockRequestSeqNoLow_bd00 : tbd00_LockRequestSeqNo;
                    (* *)
                    nd_conv_vers_space         : tgg00_ConverterVersion;
                    nd_obj_frame_len           : tsp00_Uint2;
                    nd_obj_key_len             : tsp00_Uint2;
                    (* *)
                    nd_file_vers_space         : tgg91_FileVersion;
                    nd_first_free_obj          : tgg00_ObjPagePos;
                    nd_first_obj               : tgg00_ObjPagePos;
                    nd_filler5_4               : tsp00_Int2;
                    (* *)
                    nd_obj_file_no1            : tsp00_C4;
                    ndLockRequestSeqNoHigh_bd00: tbd00_LockRequestSeqNo; (* PTS 1115760 2002-05-15 FF *)
                    (* *)
                    nd_next_free               : tsp00_PageNo;
                    nd_prev_free               : tsp00_PageNo; (* PTS 1115760 2002-05-15 FF *)
                    (* *)
                    nd_obj_file_no2            : tsp00_C4;
                    nd_write_cnt_space         : tsp00_Int4);
                5:
                    (ndStrHeaderSpace_bd00     : tsp00_C8; (* used by tfnColumn_egg00 *)
                    (* *)
                    ndStrBottomSpace_bd00      : tgg00_PagePos;
                    ndStrFiller1_bd00          : tsp00_Int4;
                    (* *)
                    ndStrLevelSpace_bd00       : tsp00_Int2;
                    ndStrFileStateSpace_bd00   : tbd_file_state_set;
                    ndStrFiller2_bd00          : boolean;
                    ndStrRootSpace_bd00        : tsp00_PageNo;
                    (* *)
                    ndStrRightSpace_bd00       : tsp00_PageNo;
                    ndStrLeftSpace_bd00        : tsp00_PageNo;
                    (* *)
                    ndStrParentID_bd00         : tgg00_Surrogate;
                    (* *)
                    ndStrConvVersionSpace_bd00 : tgg00_ConverterVersion;
                    ndStrVersion_bd00          : tsp00_Int4;
                    (* *)
                    ndStrFileVersionSpace_bd00 : tgg91_FileVersion;
                    ndStrFiller4_bd00          : tsp00_C6;
                    (* *)
                    ndStrFileSize_bd00         : tsp00_Int4;
                    ndStrFiller5_bd00          : tsp00_Int4;
                    (* *)
                    ndStrFiller6_bd00          : tsp00_C8;
                    (* *)
                    ndStrFiller7_bd00          : tsp00_Int4;
                    ndStrWriteCntSpace_bd00    : tsp00_Int4);
                7:
                    (ndHeaderSpace_bd00        : tsp00_C8;
                    (* *)
                    ndFirstOffset_bd00         : tgg00_PagePos;
                    ndFieldCount_bd00          : tsp00_Int4;
                    (* *)
                    nd_level_space2            : tsp00_Int2;
                    nd_file_state_space2       : tbd_file_state_set;
                    nd_sorted_space2           : boolean;
                    nd_root_space2             : tsp00_PageNo;
                    (* *)
                    nd_right_space2            : tsp00_PageNo;
                    nd_left_space2             : tsp00_PageNo;
                    (* *)
                    ndFirstFreeOffset_bd00     : tgg00_PagePos;
                    ndAllFieldInQueueCount_bd00: tsp00_Int4);
                8: (* Data_PageFixSizeSpace *)
                    (ndPageFixSizeSpace_bd00   : tbd00_PageFixSizeSpace);
                9: (* Log_UndoPage *)
                    (ndUndoPage_bd00           : tbd00_UndoPage);
                10 : (* Rst_RedoPage *)
                    (ndRedoPage_bd00           : tbd00_RedoPage);
                11 : (* Log_OpenTransPage *)
                    (ndOpenTransPage_bd00      : tbd00_OpenTransPage);
                END;
            (*ENDCASE*) 
 
      tbd_nodeptr = ^tbd_node;
 
      tbd_node_ptrs = RECORD
            CASE integer OF
                1:
                    (np_ptr      : tbd_nodeptr;
                    np_cbptr     : tbd_nodeptr);
                2:
                    (np_ptr_buf  : tsp00_PageAddr;
                    np_cbptr_buf : tsp00_PageAddr)
                END;
            (*ENDCASE*) 
 
      tbd_page_list     = ARRAY [1..MAX_VF_BUFFERS_BD00] OF tbd_node;
      (* *)
      tbd_pagelistptr   = ^tbd_page_list;
      (* *)
      tbd00_NodePtrList = ARRAY [1..MAX_VF_BUFFERS_BD00] OF tbd_nodeptr;
 
      tbd_univ_ptr = RECORD
            CASE integer OF
                1 :
                    (nodeaddr      : tbd_nodeptr);
                2 :
                    (bufaddr       : tsp00_PageAddr);
                3 :
                    (plistaddr     : tbd_pagelistptr);
                END;
            (*ENDCASE*) 
 
 
      tbd_current_tree = RECORD
            curr_trans                   : tgg00_TransContextPtr;
            currRootNptrs_bd00           : tbd_node_ptrs;
            currIndexNptrs_bd00          : tbd_node_ptrs;
            curr_lvl_1_pno               : tsp00_PageNo;
            curr_lvl_1_left              : tsp00_PageNo;
            currLeftBound_bd00           : tsp00_PageNo;
            currRightBound_bd00          : tsp00_PageNo;
            curr_tree_id                 : tgg00_FileId;
            currFreeQueue_bd00           : tbd00_FreeQueue;
            currNumLeaves_bd00           : tsp00_Int4;
            currLeafPageCountDelta_bd00  : tsp00_Int4;
            currIndexPageCountDelta_bd00 : tsp00_Int4;
            currCounter_bd00             : tsp00_Int2;
            currRootPageLockMode_bd00    : tbd00_PageLockMode;
            currIndexPageLockMode_bd00   : tbd00_PageLockMode;
            curr_action                  : tgg00_MessType;
            currUnlockAllowed_bd00       : boolean;
            currRootUpdated_bd00         : boolean;
            currIndexUpdated_bd00        : boolean;
            currExtendedFileTypeSet_bd00 : tgg00_ExtendedFiletypeSet;
            currFill1                    : boolean;
            currFill2                    : tsp00_Int2;
      END;
 
 
      tbd_neighbors = RECORD
            pre_ln : tsp00_PageNo;
            ln     : tsp00_PageNo;
            rn     : tsp00_PageNo
      END;
 
      tbd_searchresult = (
            thisfound,
            nextfound,
            lastfound,
            nonefound);
      (* *)
      tbd00_SepLeafCount = tgg90_Cint4;
      (* *)
 
      tbd00_Separator = RECORD
            CASE integer OF
                1:
                    (sepHead_bd00     : tgg00_HeaderRec);
                2:
                    (sepKey_bd00      : tgg00_Lkey;
                    sepLeafCount_bd00 : tbd00_SepLeafCount);
                END;
            (*ENDCASE*) 
 
      tbd00_SeparatorPtr = ^tbd00_Separator;
      (* *)
      tbd00_TreeIndexOp  = (
            opAdd_ebd00,
            opDel_ebd00,
            opRepl_ebd00);
 
      tbd00_TreeIndexOrder = RECORD
            txoOp_bd00        : tbd00_TreeIndexOp;
            txoFill_bd00      : boolean;
            txoLevel_bd00     : tsp00_Int2;
            txoSearchKey_bd00 : tgg00_Lkey;
            txoSep_bd00       : tbd00_Separator
      END;
 
      tbd00_TreeIndexOrderPtr  = ^tbd00_TreeIndexOrder;
 
      tbd00_TreeStatistic = RECORD
            ts_IndexPages_bd00  : tsp00_Int4;
            ts_LeafPages_bd00   : tsp00_Int4;
            ts_RecordCount_bd00 : tsp00_Int4;
      END;
 
 
      tbd00_OrderList = RECORD
            olstCount_bd00 : tsp00_Int2; (* 0..6 *)
            olstFill_bd00  : tsp00_Int2;
            olstOrder_bd00 : ARRAY  [LWB_OF_LIST_BD00..UPB_OF_LIST_BD00] OF tbd00_TreeIndexOrder
      END;
 
 
      tbd_stat_aux_vars = RECORD
            sav_separators  : tsp00_Int4;
            sav_long_oflw   : boolean;
            sav_reclen_oflw : boolean
      END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
.PA 
