reftable: define version 2 of the spec to accomodate SHA256
Version appends a hash ID to the file header, making it slightly larger.
This commit also changes "SHA-1" into "object ID" in many places.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Han-Wen Nienhuys5 years agocommitted byJunio C Hamano
* Near constant time lookup for any single reference, even when the
repository is cold and not in process or kernel cache.
* Near constant time verification if a SHA-1 is referred to by at least
* Near constant time verification if an object name is referred to by at least
one reference (for allow-tip-sha1-in-want).
* Efficient enumeration of an entire namespace, such as `refs/tags/`.
* Support atomic push with `O(size_of_update)` operations.
@ -210,8 +210,8 @@ and non-aligned files.
@@ -210,8 +210,8 @@ and non-aligned files.
Very small files (e.g. a single ref block) may omit `padding` and the ref
index to reduce total file size.
Header
^^^^^^
Header (version 1)
^^^^^^^^^^^^^^^^^^
A 24-byte header appears at the beginning of the file:
@ -232,6 +232,26 @@ used in a stack for link:#Update-transactions[transactions], these
@@ -232,6 +232,26 @@ used in a stack for link:#Update-transactions[transactions], these
fields can order the files such that the prior file's
`max_update_index + 1` is the next file's `min_update_index`.
Header (version 2)
^^^^^^^^^^^^^^^^^^
A 28-byte header appears at the beginning of the file:
....
'REFT'
uint8( version_number = 2 )
uint24( block_size )
uint64( min_update_index )
uint64( max_update_index )
uint32( hash_id )
....
The header is identical to `version_number=1`, with the 4-byte hash ID
("sha1" for SHA1 and "s256" for SHA-256) append to the header.
For maximum backward compatibility, it is recommended to use version 1 when
writing SHA1 reftables.
First ref block
^^^^^^^^^^^^^^^
@ -319,8 +339,8 @@ The `value` follows. Its format is determined by `value_type`, one of
@@ -319,8 +339,8 @@ The `value` follows. Its format is determined by `value_type`, one of
the following:
* `0x0`: deletion; no value data (see transactions, below)
* `0x1`: one 20-byte object name; value of the ref
* `0x2`: two 20-byte object names; value of the ref, peeled target
* `0x1`: one object name; value of the ref
* `0x2`: two object names; value of the ref, peeled target