Module asuran::repository::backend::common::generic_flatfile[][src]

Expand description

Asuran FlatFile’s are structured as an initial header, followed by an append only log of ‘entries’.

Initial Header

The initial header contains three components:

  1. Magic Number

    The magic number identifying asuran FlatFiles is the 8-byte string b"ASURAN_F".

  2. Length of header

    The total length of the encrypted key, in bytes, as a u16.

  3. The EncryptedKey

    The serialized, encrypted key material for this repository.

The first byte of the first entry immediately follows the last byte of the initial header

Entries

An entry is composed of three parts:

  1. The Header

    The header is a sequence of three u16s, each indicating the major, minor, and patch version of the version of asuran to last write to the file. This is then followed by the 16-byte implementation UUID. This is then followed by two u64s, the first being the location of the footer, and the second being the location of the next header. The location of the next header will be beyond the end of the file if you are reading the last entry in a file.

  2. The Body

    The body is a length of concatenated raw chunk bodies, and does not contain any structure beyond being a list of bytes.

  3. The Footer

    The footer contains two parts, a u64 describing the length of the following Chunk, then the serialized EntryFooterData struct, wrapped and encrypted/compressed in a Chunk

FlatFile repositories are always terminated with an EntryHeader with the footer_offset and next_header_offset set to 0. This is intended to be overridden during the next writing session.

Structs

A view over a generic FlatFile backend.

Constants