Skip to content
benhj edited this page Apr 27, 2014 · 3 revisions

In TeaSafe, folders are like files in that they are constructed from file blocks. A given folder consists of a number of byte sequences:

  1. An 8 byte sequence. This stores the number of 'entries' inside of the folder
  2. An arbitrary number of 264 byte sequences. Each ith byte sequence is metadata for a given entry in the folder. An entry is either a file or a folder.

When a new entry is added to the folder the 64 bit counter is incremented and a new 264 byte sequence is appended to the entry data that represents the folder. The structure of this sequence is depicted below:

Folder metadata

As shown the filename can have a maximum of 255 characters. The end of the name is delimited by a null byte.

Thus, the whole folder structure is a chain of metadata elements. When a new entry is added, a new metadata element is either appended to the end or overwrites an old metadata element if the latter is found to 'not be in use'. It won't be in use if the associated entry was at some point deleted; this will be indicated by the first bit of the element being in an unset state.

Clone this wiki locally