Filesystem - Launch Core

Problem

Systems need a way to store information in persistent storage, such as SPI flash, an SD card, EEPROM, etc.

Persistent information stored could be:

  • Sensor readings collected during flight
  • Metrics collected about the system
  • Configuration information
  • etc.

Requirements

Arbitrary data must be able to be written and read persistently. Files will only be written to and read from sequentially, random access is NOT required.

Files can be "read only" once closed, the system does NOT need to support writing to old files, but old files must be able to be read from.

The system must be able to store multiple files.

New files must be able to be created.

Old files must be able to be removed. Selective removal of files is NOT required, i.e. it is okay to just have a function to remove all files.

Only one file is required to be open at a time, multiple files being open at once is not required.

The filesystem must be platform independent, it cannot not rely on unique features of an architecture.

The filesystem must be device independent, it cannot rely on having a specific flash device (this is up to the device driver to manage). Notably, it must be able to work with variable block sizes.

The filesystem must automatically store information in persistent storage at a reasonable rate. This is a somewhat arbitrary requirement, and really just means don't store all the information in memory and flush it to the storage device once every year. It also means that information can be buffered before writing to storage, as long as it written within some reasonable time after, or a mechanism to flush data to storage is provided.

Writes to blocks of a storage device should be kept to a minimum. Many devices have a limited numbers of writes so the filesystem needs to be conscious of this and efficiently write blocks. For example, don't read a block, change a single byte, and write it back for every byte written to the filesystem, instead buffer data until you have a full block.


Givens

The filesystem will be given a "BlockDevice" object that it can perform block reads and writes on. The source for this interface can be found here. Consequentially, there needs to be a way to pass this device to the filesystem, either through a function, constructor, etc.