Skip to content

Layout

The Layout record contains metadata of a file or directory that should be written to the mass memory. When combined with a Content record (and possibly an Index record), it is possible to write the file or directory on disk in a reproducible way.

It is composed of a 32 bytes long header-like section and two fields of variable length.

Field Type Size (bytes) Description
uid uint 4 User ID of the owner of the file.
gid uint 4 Group ID of the owner of the file.
mode uint 4 File’s mode and permission bits.
tag blob 4 Unused.
source_length uint 2 Length of the source blob.
target_length uint 2 Length of the target string.
file_type uint 1 Type of file to be written.
padding blob 11 Unused.
source blob Specified by source_length “source” of the file. Its meaning varies depending on file_type.
target str Specified by target_length Path where the file should be written to.

file_type is an enum that specifies the type of file that should be written on disk.

ValueNameDescriptionMeaning of source
1RegularRegular file of data.

XXH3_128bits hash of the file.
The source is a hash because our package manager, Moss, uses a CAS to store files. This hash may be also used to match an Index record, in order to identify a region of a Content record to read. In fact, the Index record also contains a XXH3_128bits-based hash.

2SymlinkSymbolic link to another file.String. Original file path to link somewhere else.
3DirectoryEmpty directory.Unused.
4CharacterDeviceCharacter device.Unused.
5BlockDeviceBlock device.Unused.
6FIFOPOSIX FIFO.Unused.
7SocketPOSIX communication socket.Unused.