Skip to content

Commit

Permalink
Add header comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
broneill committed Aug 30, 2024
1 parent 8ea4f21 commit db164c1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/org/cojen/tupl/core/LocalDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,30 @@ private static int nodeCountFromBytes(long bytes, int pageSize) {
return count <= Integer.MAX_VALUE ? (int) count : Integer.MAX_VALUE;
}

/*
The database header is stored in the "extra data" section as defined by StoredPageDb,
which starts at offset 256 and is limited to 256 bytes in size.
+------------------------------------------+
| StoredPageDb header (256 bytes) |
+------------------------------------------+
| int: encoding version |
| long: root page id |
| long: master undo log page id |
| long: transaction id |
| long: checkpoint number |
| long: redo transaction id |
| long: redo position |
| long: replication encoding version |
+------------------------------------------+
| reserved (196 bytes) |
+------------------------------------------+
The reserved section is used by CipherCrypto when encryption is enabled.
*/

private static final int I_ENCODING_VERSION = 0;
private static final int I_ROOT_PAGE_ID = I_ENCODING_VERSION + 4;
private static final int I_MASTER_UNDO_LOG_PAGE_ID = I_ROOT_PAGE_ID + 8;
Expand Down

0 comments on commit db164c1

Please sign in to comment.