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
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
| No | Field | Description | Position | Size |
|---|---|---|---|---|
| 1 | Version | The ODB File format version | 0 | 1 byte |
| 2 | Database ID | A unique identifier of the ODB database file | 1 | 4 Long |
| 3 | Number of classes | The number of classes in meta model | 33 | 1 int |
| 4 | First ClassInfo OID | The OID of the first ClassInfo of the meta model | 37 | 1 long |
| 5 | Last ODB Close status | To check last close status : 1 is ok, 0 is not | 45 | 1 boolean |
| 6 | Is user/password protected | Does it need a user/password to access database: 1=yes,0=no | 46 | 1 boolean |
| 7 | User name | The user name, if exist , if does not exist 'no-user' | 47 | 50 bytes |
| 8 | User password | The encrypted user password , if no password : 'no-password' | 97 | 50 bytes |
| 9 | Current block id position | Which is the current id block to be used | 147 | 1 Long |
| 10 | First ID Block | The first block of ids | 155 | 1000 bytes |
Header size = 155
Total header size, including first id block of 1000 entries = 155 + 18034 = 18189
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.






