|
| 1 | +--- |
| 2 | +title: Layout |
| 3 | +lastUpdated: 2026-04-22T00:00:00Z |
| 4 | +description: The format of the Layout record |
| 5 | +--- |
| 6 | + |
| 7 | +The Layout record contains metadata of a file or directory that should be written to the mass memory. |
| 8 | +When combined with a Content record (and possibly an Index record), it is possible to write the file |
| 9 | +or directory on disk in a reproducible way. |
| 10 | + |
| 11 | +It is composed of a 32 bytes long header-like section and two fields of variable length. |
| 12 | + |
| 13 | +| Field | Type | Size (bytes) | Description | |
| 14 | +|---|---|---|---| |
| 15 | +| uid | uint | 4 | User ID of the owner of the file. | |
| 16 | +| gid | uint | 4 | Group ID of the owner of the file. | |
| 17 | +| mode | uint | 4 | File's mode and permission bits. | |
| 18 | +| tag | blob | 4 | Unused. | |
| 19 | +| source_length | uint | 2 | Length of the `source` blob. | |
| 20 | +| target_length | uint | 2 | Length of the `target` string. | |
| 21 | +| file_type | uint | 1 | Type of file to be written. | |
| 22 | +| padding | blob | 11 | Unused. | |
| 23 | +| source | blob | Specified by `source_length` | "source" of the file. Its meaning varies depending on `file_type`. | |
| 24 | +| target | str | Specified by `target_length` | Path where the file should be written to. | |
| 25 | + |
| 26 | +### file_type |
| 27 | + |
| 28 | +`file_type` is an enum that specifies the type of file that should be written on disk. |
| 29 | + |
| 30 | +|Value|Name|Description|Meaning of `source`| |
| 31 | +|---|---|---|---| |
| 32 | +| 1 | Regular | Regular file of data. |<a href="https://xxhash.com">XXH3_128bits</a> hash of the file.<br></br>The source is a hash because our package manager, Moss, uses a [CAS](https://en.wikipedia.org/wiki/Content-addressable_storage) to store files. | |
| 33 | +| 2 | Symlink | Symbolic link to another file. | String. Original file path to link somewhere else. | |
| 34 | +| 3 | Directory | Empty directory. | Unused. | |
| 35 | +| 4 | CharacterDevice | [Character device](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_91). | Unused. | |
| 36 | +| 5 | BlockDevice | [Block device](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_79). | Unused. | |
| 37 | +| 6 | FIFO | [POSIX FIFO](https://man7.org/linux/man-pages/man7/fifo.7.html). | Unused. | |
| 38 | +| 7 | Socket | [POSIX communication socket](https://man7.org/linux/man-pages/man2/socket.2.html). | Unused. | |
0 commit comments