View Source PropertyTable.PersistFile (property_table v0.2.3)

This module contains methods to aid in writing the contents of a PropertyTable to a custom file format.

The structure of the format is the following:

  +------------------------------+
  | HEADER 'PTABLE'              | Used to initially validate the file [0x00]
  +------------------------------+
  | FILE VERSION (uint8)         | Used to track the internal PropertyTable structure of the file [0x06]
  +------------------------------+
  | RESERVED (8 bits)            | Reserved [0x07]
  +------------------------------+
  | PAYLOAD SIZE (uint64)        | Length in bytes of the payload that follows [0x08]
  +------------------------------+
  | PAYLOAD BYTES (above size)   | Raw erlang term bytes of the table contents [0x10]
  +------------------------------+
  | PAYLOAD HASH (MD5 128 bits)  | MD5 Checksum of the bytes when they were written, ensures table integrity [0x10 + payload_size]
  +------------------------------+

Link to this section Summary

Link to this section Functions

@spec decode_file(binary()) :: {:error, :bad_checksum | :bad_file} | {:ok, binary()}
Link to this function

encode_binary(table_content_binary)

View Source
@spec encode_binary(binary()) :: [binary(), ...]