Odb File Format Version 1.9

In the current version, ODB stores all its data in a single file:

  • Meta-model : classes that are stored in the object base
  • Objects thats are stored
  • Indexes

File Format Big Picture

file-format.png

ODB file format has the following block types:

  • Header Block
  • ID Block
  • Class Info Block
  • Object Block

Indexes are stored in the database as normal objects using the org.neodatis.odb.core.meta.ClassInfoIndex class. This class is marked as a system class (org.neodatis.odb.core.introspector.ClassIntrospector.getClassCategory(String fullClassName) to

Conventions :
1 Long = 8 bytes
1 Integer = 4 bytes

In the current version of ODB, entities are stored in the database file as two ways linked list.

Let's take an example to understand that:

An object which is managed by a NonNativeObjectInfo (Layer 2) object contains the data of the objects, the OID of the its class (ClassInfo) and some pointers:

  • A pointer to the next object of the same type
  • A pointer to the previous object of the same type

This pointers allow the navigation from an object to other. Like a two ways Linked list. This is simple way to handle object navigation but have some drawbacks for the Isolation property of ACID): See here the new ODB file format for version 2 to resolve them.

ODB Header

This table is currently being edited! (06/04/2008)
Changes from 1.8 are in red

No Field Description Position Size
1 Use encryption To indicate if database file use encryption 0 1 byte
2 Version The ODB File format version 1 1 int
3 Original Language A flag to keep the original language used to create database (Java=1,C#=2…) 5 1 byte
4 Database ID A unique identifier of the ODB database file 6 4 Long
5 Is Replicated To indicate if the database is being replicated 6+4*8=38 1 byte
6 Last Transaction sequential ID The last Transaction Sequential ID 39 2 Long
7 Number of classes The number of classes in meta model 39+2*8=55 1 long
8 First ClassInfo OID The OID of the first ClassInfo of the meta model 63 1 long
9 Last ODB Close status To check last close status : 1 is ok, 0 is not 71 1 boolean
10 Database String Encoding The Database String Encoding, default is UTF8 72 50 bytes + 8 bytes for string size = 58 bytes
11 Is user/password protected Does it need a user/password to access database: 1=yes,0=no 130 1 boolean
12 User name The user name, if exist , if does not exist 'no-user' 131 50 bytes + 8 bytes for string size = 58 bytes
13 User password The encrypted user password , if no password : 'no-password' 189 50 bytes + 8 bytes for string size = 58 bytes
14 Current block id position Which is the current id block to be used 247 1 Long
15 First ID Block The first block of ids 255 1000 bytes

Header size = 255
Total header size, including first id block of 1000 entries = 255 + 18034 = 18289

Implementation

This format is implemented by the the org.neodatis.odb.core.io.Writer for writing and org.neodatis.odb.core.io.ObjectReader for reading.

org.neodatis.odb.core.io.StorageEngineConstant contains some constant value for each field position.

page_revision: 27, last_edited: 1223389757|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License