diff options
author | Derrick Stolee <derrickstolee@github.com> | 2022-11-07 18:35:42 +0000 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-11-07 13:53:52 -0500 |
commit | c25606aea1c233e4914acc8d73111b4aeb63661e (patch) | |
tree | 70f97a34d13ed8cbc57b5f86832f051e5311446f | |
parent | a451b3db25db4ff8596ce733eab2ec98c1010f12 (diff) | |
download | git-c25606aea1c233e4914acc8d73111b4aeb63661e.tar.gz |
chunk-format: document trailing table of contents
It will be helpful to allow a trailing table of contents when writing
some file types with the chunk-format API. The main reason is that it
allows dynamically computing the chunk sizes while writing the file.
This can use fewer resources than precomputing all chunk sizes in
advance.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
-rw-r--r-- | Documentation/gitformat-chunk.txt | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Documentation/gitformat-chunk.txt b/Documentation/gitformat-chunk.txt index c01f5567c4..ee3718c430 100644 --- a/Documentation/gitformat-chunk.txt +++ b/Documentation/gitformat-chunk.txt @@ -52,8 +52,27 @@ The final entry in the table of contents must be four zero bytes. This confirms that the table of contents is ending and provides the offset for the end of the chunk-based data. +The default chunk format assumes the table of contents appears at the +beginning of the file (after the header information) and the chunks are +ordered by increasing offset. Alternatively, the chunk format allows a +table of contents that is placed at the end of the file (before the +trailing hash) and the offsets are in descending order. In this trailing +table of contents case, the data in order looks instead like the following +table: + + | Chunk ID (4 bytes) | Chunk Offset (8 bytes) | + |--------------------|------------------------| + | 0x0000 | OFFSET[C+1] | + | ID[C] | OFFSET[C] | + | ... | ... | + | ID[0] | OFFSET[0] | + +The concrete file format that uses the chunk format will mention that it +uses a trailing table of contents if it uses it. By default, the table of +contents is in ascending order before all chunk data. + Note: The chunk-based format expects that the file contains _at least_ a -trailing hash after `OFFSET[C+1]`. +trailing hash after either `OFFSET[C+1]` or the trailing table of contents. Functions for working with chunk-based file formats are declared in `chunk-format.h`. Using these methods provide extra checks that assist |