-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document file system object content addressing
- Loading branch information
1 parent
da1e977
commit 4706b5e
Showing
19 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
doc/manual/src/store/file-system-object/content-address.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Content-Addressing File System Objects | ||
|
||
Nix | ||
What we really care about with Nix is content addressing store objects. | ||
But since every store object has a root file system object, we need to content address them too. | ||
|
||
## Flat Hashing | ||
|
||
A single file object can just be hashed by its contents. | ||
This is not enough information to encode the fact that the file system object is a file, | ||
but if we *already* know that the FSO is a single file by other means, it is sufficient. | ||
|
||
## Nix Archive (NAR) | ||
|
||
To perform operations on FSOs such as computing cryptographic hashes, scanning for references, and so on, it is useful to be able to *serialise* FSOs into byte sequences, which can then be deserialised back into FSOs that are stored in the file system. | ||
Examples of such serialisations are the ZIP and TAR file formats. | ||
However, for our purposes these formats have two problems: | ||
|
||
- They do not have a canonical serialisation, meaning that given an FSO, there can | ||
be many different serialisations. | ||
For instance, TAR files can have variable amounts of padding between archive members; | ||
and some archive formats leave the order of directory entries undefined. | ||
This is bad because we use serialisation to compute cryptographic hashes over FSOs, and therefore require the serialisation to be unique. | ||
Otherwise, the hash value can depend on implementation details or environment | ||
settings of the serialiser. | ||
|
||
- They store more information than we have in our notion of FSOs, such as time stamps. | ||
This can cause FSOs that Nix should consider equal to hash to different values on different machines, just because the dates differ. | ||
|
||
- As a practical consideration, the TAR format is the only truly universal format in the Unix environment. | ||
It has many problems, such as an inability to deal with long file names and files larger than 233 bytes. | ||
Current implementations such as GNU Tar work around these limitations in various ways. | ||
|
||
For these reasons, Nix has its very own archive format—the Nix Archive (NAR) format. | ||
|
||
The more general solution is a custom serialization avoiding the problems described above. | ||
The Nix Archive (NAR) format is designed to fit this requirements. | ||
|
||
The exact specification of the Nix Archive format is in `protocols/nix-archive.md` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters