Merge pull request #4210 from aawsome/patch-1

docs: Corrections/extra information in design.rst
This commit is contained in:
Michael Eischer 2023-03-12 12:00:25 +01:00 committed by GitHub
commit eb7dbc88b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 11 deletions

View File

@ -45,10 +45,12 @@ comparing its output to the file name. If the prefix of a filename is
unique amongst all the other files in the same directory, the prefix may unique amongst all the other files in the same directory, the prefix may
be used instead of the complete filename. be used instead of the complete filename.
Apart from the files stored within the ``keys`` directory, all files are Apart from the files stored within the ``keys`` and ``data`` directories,
encrypted with AES-256 in counter mode (CTR). The integrity of the all files are encrypted with AES-256 in counter mode (CTR). The integrity
encrypted data is secured by a Poly1305-AES message authentication code of the encrypted data is secured by a Poly1305-AES message authentication
(sometimes also referred to as a "signature"). code (sometimes also referred to as a "signature").
Files in the ``data`` directory ("pack files") consist of multiple parts
which are all independently encrypted and authenticated, see below.
In the first 16 bytes of each encrypted file the initialisation vector In the first 16 bytes of each encrypted file the initialisation vector
(IV) is stored. It is followed by the encrypted data and completed by (IV) is stored. It is followed by the encrypted data and completed by
@ -298,8 +300,8 @@ example, the Pack ``73d04e61`` contains two data Blobs and one Tree
blob, the plaintext hashes are listed afterwards. The ``length`` field blob, the plaintext hashes are listed afterwards. The ``length`` field
corresponds to ``Length(encrypted_blob)`` in the pack file header. corresponds to ``Length(encrypted_blob)`` in the pack file header.
Field ``uncompressed_length`` is only present for compressed blobs and Field ``uncompressed_length`` is only present for compressed blobs and
therefore is never present in version 1. It is set to the value of therefore is never present in version 1 of the repository format. It is
``Length(blob)``. set to the value of ``Length(blob)``.
The field ``supersedes`` lists the storage IDs of index files that have The field ``supersedes`` lists the storage IDs of index files that have
been replaced with the current index file. This happens when index files been replaced with the current index file. This happens when index files
@ -410,7 +412,9 @@ and pretty-print the contents of a snapshot file:
{ {
"time": "2015-01-02T18:10:50.895208559+01:00", "time": "2015-01-02T18:10:50.895208559+01:00",
"tree": "2da81727b6585232894cfbb8f8bdab8d1eccd3d8f7c92bc934d62e62e618ffdf", "tree": "2da81727b6585232894cfbb8f8bdab8d1eccd3d8f7c92bc934d62e62e618ffdf",
"dir": "/tmp/testdata", "paths": [
"/tmp/testdata"
],
"hostname": "kasimir", "hostname": "kasimir",
"username": "fd0", "username": "fd0",
"uid": 1000, "uid": 1000,
@ -436,7 +440,9 @@ becomes:
{ {
"time": "2015-01-02T18:10:50.895208559+01:00", "time": "2015-01-02T18:10:50.895208559+01:00",
"tree": "2da81727b6585232894cfbb8f8bdab8d1eccd3d8f7c92bc934d62e62e618ffdf", "tree": "2da81727b6585232894cfbb8f8bdab8d1eccd3d8f7c92bc934d62e62e618ffdf",
"dir": "/tmp/testdata", "paths": [
"/tmp/testdata"
],
"hostname": "kasimir", "hostname": "kasimir",
"username": "fd0", "username": "fd0",
"uid": 1000, "uid": 1000,
@ -495,9 +501,18 @@ the JSON is indented):
} }
A tree contains a list of entries (in the field ``nodes``) which contain A tree contains a list of entries (in the field ``nodes``) which contain
meta data like a name and timestamps. When the entry references a meta data like a name and timestamps. Note that there are some specialities of how
directory, the field ``subtree`` contains the plain text ID of another this metadata is generated:
tree object.
- The name is quoted using `strconv.Quote <https://pkg.go.dev/strconv#Quote>`__
before being saved. This handles non-unicode names, but also changes the
representation of names containing ``"`` or ``\``.
- The filemode saved is the mode defined by `fs.FileMode <https://pkg.go.dev/io/fs#FileMode>`__
masked by ``os.ModePerm | os.ModeType | os.ModeSetuid | os.ModeSetgid | os.ModeSticky``
When the entry references a directory, the field ``subtree`` contains the plain text
ID of another tree object.
When the command ``restic cat blob`` is used, the plaintext ID is needed When the command ``restic cat blob`` is used, the plaintext ID is needed
to print a tree. The tree referenced above can be dumped as follows: to print a tree. The tree referenced above can be dumped as follows: