From 091c48bc37c0ee94359e4e21de949213a9b1f5c2 Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Fri, 25 Feb 2022 12:53:58 +0100 Subject: [PATCH] docs: Clarify on-disk order and size of log entry fields (#6357) docs: clarify on-disk order and size of log entry fields The order of the fields of a log entry on disk is CRC32 first, the docs had the size first. I tried to make this list similar to the HashIndex struct description. --- docs/internals/data-structures.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/internals/data-structures.rst b/docs/internals/data-structures.rst index 6d1b4ab07..9e1c067f2 100644 --- a/docs/internals/data-structures.rst +++ b/docs/internals/data-structures.rst @@ -94,13 +94,13 @@ this value in a non-empty repository, you may also need to relocate the segment files manually. A segment starts with a magic number (``BORG_SEG`` as an eight byte ASCII string), -followed by a number of log entries. Each log entry consists of: +followed by a number of log entries. Each log entry consists of: (in this order) -* 32-bit size of the entry -* CRC32 of the entire entry (for a PUT this includes the data) -* entry tag: PUT, DELETE or COMMIT -* PUT and DELETE follow this with the 32 byte key -* PUT follow the key with the data +* First, unsigned 32-bit number, the CRC32 of the entire entry (for a PUT including the DATA) excluding the CRC32 field +* Second, unsigned 32-bit size of the entry (including the whole header) +* Third, unsigned 8-bit entry tag: PUT(1), DELETE(2) or COMMIT(3) +* Fourth, on PUT or DELETE, 32 byte key +* Fifth, PUT only, (size - 41) bytes of data (length = size - sizeof(CRC32) - sizeof(size) - sizeof(entry tag) - sizeof(key)) Those files are strictly append-only and modified only once.