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:
-
Magic Number
The magic number identifying asuran
FlatFile
s is the 8-byte stringb"ASURAN_F"
. -
Length of header
The total length of the encrypted key, in bytes, as a u16.
-
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:
-
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
u64
s, 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. -
The Body
The body is a length of concatenated raw chunk bodies, and does not contain any structure beyond being a list of bytes.
-
The Footer
The footer contains two parts, a
u64
describing the length of the followingChunk
, then the serializedEntryFooterData
struct, wrapped and encrypted/compressed in aChunk
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.