/* @lastChanged: "1999-10-20  17:41"
 
 * @filename:   gbd00
 * @purpose:    "BD_kernel_constants_and_types"
 * @release:    7.2
 * @see:        "-.-"
 *
 * @copyright:  (c) 1999-2004 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;
      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 --- *)
      (* *)
      COUNT_ONLY_BD00            = true;
      LOCK_RESET_BD00            = true;
      ONLY_EMPTY_BD00            = true;
      ONLY_RESET_BD00            = true;
      RELEASE_FRAME_BD00         = true;
      REQ_LOCK_BD00              = true;
      LOCK_TREE_EXCL_BD00        = true;
      LOCK_LEAF_EXCL_BD00        = true;
      SYNC_EXCL_LOCK_BD00        = true;
      FILE_EXT_COR_BD00          = '.cor';
      (* *)
      MAX_NODE_SCAN_BD00         = 5;
      MAX_SCAN_INDEX_NODE_BD00   = 5;
      LWB_OF_LIST_BD00           = 1;
      UPB_OF_LIST_BD00           = 6;
      MAX_DATA_WRITER_BD00       = 64;
      MAX_OBJ_GARB_COLL_BD00     = 64;
      MAX_VF_BUFFERS_BD00        = 16;(* see cserv.pcf *)
      MAX_FREE_QUEUE_BD00        = 5;
      cbd_cspmaxint4_mxspbuf     = MAX_INT4_SP00 - PAGE_MXSP00;
      (* cbd_cspmaxint4_mxspbuf  = 2147479551; *)
      (* *)
      NIL_CHAIN_NO_BD00          = MAX_INT2_SP00;
      NIL_RECINDEX_BD00          = -MAX_INT2_SP00;  (* must be < -1 *)
      (* *)
      ZERO_LOCK_REQUEST_SEQ_NO_BD00  = 0;
      (*MAX_LOCK_REQUEST_SEQ_NO_BD00 = MAX_INT4_SP00; PTS 1115760 2002-05-15 FF *)
      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_PageLockMode = (
            plmLock_ebd00,
            plmLockForSplit_ebd00,
            plmLockForSplitNoWait_ebd00,
            plmLockWithoutReschedule_ebd00); (* PTS 1115176 TS 2002-04-09 *)
      (* *)
      tbd_node_request = (
            nr_for_read,
            nr_for_update,
            nr_for_upd_ret_if_blocked);
      (* *)
      tbd_lru_info = (
            lru_normal,
            lru_mid,
            lru_last);
      (* *)
      tbd_file_msg_type = (
            fmsg_bad,
            fmsg_checked,
            fmsg_repaired);
      (* *)
      tbd_file_state_set = SET OF
            (f_unloaded,
            f_bad,
            f_read_only,
            f_not_accessible,
            f_write_off,
            f_no_tree_index);
      (* *)
      tbd_fileinfo_desc_set = SET OF
            (fid_user_ref,
            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_ErrorTextRecord = RECORD
            CASE integer OF
                1  :
                    (etrBuf_bd00 : PACKED ARRAY [1..ERRTEXTREC_MXBD00] OF char);
                2 :
                    (etrRecLen_bd00      : tsp00_Int2;
                    etrKeyLen_bd00       : tsp00_Int2;
                    etrVarcolOffset_bd00 : tsp00_Int2;
                    etrVarcolCnt_bd00    : tsp00_Int2;
                    etrTaskId_bd00       : tsp00_TaskId;
                    etrNotZero_bd00      : boolean;
                    etrType_bd00         : tgg00_ErrorText;
                    etrBasisError_bd00   : tgg00_BasisError;
                    etrText_bd00         : tsp00_C256);
                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 tsp00_Int4;
            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;
 
      tbd_node = RECORD
            CASE integer OF
                1:
                    (nd_header                 : tgg00_PageHeader);
                2:
                    (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;
                    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;
                    nd_left                    : tsp00_PageNo;
                    (* *)
                    nd_last                    : tsp00_PageNo;
                    nd_leaf_no                 : tsp00_PageNo;
                    (* *)
                    nd_conv_version            : tsp00_Int4;
                    nd_str_version             : tsp00_Int4;
                    (* *)
                    nd_file_version            : tgg91_FileVersion;
                    nd_filler2                 : tsp00_Int2;
                    ndInvUsageCnt_bd00         : tsp00_Int4;
                    (* *)
                    ndLeafCount_bd00           : tsp00_Int4;
                    ndTreeLeaves_bd00          : tsp00_Int4;
                    (* *)
                    nd_trans_id                : tgg91_TransNo;
                    nd_filler4                 : tsp00_Int2;
                    (* *)
                    ndInvRoot_bd00             : tsp00_PageNo; (* 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_space0                  : boolean;                       (* PTS 1115760 2002-05-15 FF *)
                    nd_root_space              : tsp00_PageNo;
                    (* *)
                    nd_right_space             : tsp00_PageNo;
                    nd_left_space              : tsp00_PageNo;
                    (* *)
                    nd_chain_no                : tsp00_Int2;
                    nd_in_free_chain           : boolean;
                    nd_assigned_to_spec_trans  : boolean;       (* PTS 1135542 FF no chaining of page to free-chain *)
                    (* 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; (* PTS 1115760 2002-05-15 FF *)
                    (* *)
                    nd_conv_vers_space         : tsp00_Int4;
                    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_num_chain_updater_mig   : tsp00_Int2;   (* PTS 1113635 only for migration *)
                    (* *)
                    nd_obj_file_no             : tgg00_ObjFileNo;
                    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_sub_root                : tsp00_PageNo;
                    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;
                    (* *)
                    ndStrFiller3_bd00          : tsp00_C8;
                    (* *)
                    ndStrConvVersionSpace_bd00 : tsp00_Int4;
                    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);
                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;
            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;
      END;
 
 
      tbd_neighbors = RECORD
            pre_ln : tsp00_PageNo;
            ln     : tsp00_PageNo;
            rn     : tsp00_PageNo
      END;
 
 
      tbd_cover_info = RECORD
            ncov      : tsp00_Int2;
            neighbcov : tsp00_Int2
      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_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 
