company logo

EBI Index Level Table

Addressing within the database is managed by internal database entry numbers (LOID), that provide access to different kind of database entries. In this sense, a database entry is any contiguous data section in a database file. Since the size of database entries may change, database entries cannot be accessed via fixed addresses. Hence, ODABA assigns LOIDs to database entries (consecutive numbers with main base identifier), which are used to access an EBI that contains the current file position and data area number.

In the first step, the main base number is extracted from LOID. Than, the EBI index level is determined, which corresponds to the byte size of LOID after removing leading zeros (minus 1). E.g.LOID 517 (2/05) occupies two bytes an will start with level 1 in the level table. The level table points to the file location of entry 0 on that level. The level table is stored for each main base header:

EB_extHeader


Pos    

Size

0

2

64-bit file access support

2

4

Header identifier (e.g. EBRB for root base header)

6

2

Modification count (uint16)

8

2

Header size (int16)

10

3

reserved for future use

EB_extDAHeader (inherits EB_extHeader)


Pos    

Size

13

2

Number of data area

15

8

Maximum data area size

23

4

reserved for future use

27

2

Header version

29

8

Next write position in data area file

37

6

reserved for future use

EB_extSBHeader (inherits EB_exDAtHeader)


Pos    

Size

43

2

Number of sub base

45

2

Number of data area currently in use

47

2

Number of data areas

49

4

Maximum entry size

EB_extMBHeader (inherits EB_extSBHeader)


Pos    

Size

53

2

main base number

55

2

Number of sub bases (always 1)

57

8

Last LOID for main base

65

8

List of unused LOIDs (not yet supported)

73

8

File position for level 0 index (EBI list)

81

8

File position for level 1 index (64 bit file pointer)

89

8

File position for level 2 index (64 bit file pointer)

97

8

File position for level 3 index (64 bit file pointer)

105

8

File position for level 4 index (64 bit file pointer)

113

8

File position for level 5 index (64 bit file pointer)

121

1

Platform independent storage format

In order to get the EBI for LOID 517 (2/5), the database looks at level1 index + 2*8 and obtains the file position for the level 0 index entry. The EBI is now the 5th EBI in the index entry:

    &EBI = :*(level1 index + 2*8) + 5*sizeof(EBI)

Now, when we found the EBI, we get file position and maximum size to read the database entry.