docs/reference/system-functional/file-management.md
File management provides the capability to manipulate files on the spacecraft file system, transfer files between the ground and the spacecraft in both directions, route delivered files to appropriate handlers, and perform large file I/O operations without blocking time-critical components. These capabilities are delivered by a set of collaborating components that together support the full lifecycle of file operations.
The File Manager provides ground commands for common file and directory operations:
Each operation reports its result via events. File system operations execute in the File Manager's own thread to avoid blocking the commanding path.
File downlink transfers files from the spacecraft to the ground. The File Downlink component reads a file from the file system, breaks it into packets, and sends them through the communication stack. Both operators and other components can initiate downlinks.
Downlink operations support:
File data is broken into fixed-size packets, with each packet containing a sequence number and offset for reassembly on the ground.
File uplink receives files from the ground and writes them to the spacecraft file system. The File Uplink component receives file packets from the communication stack, reassembles them, and writes the complete file to the specified path.
File uplink handles:
The File Dispatcher routes delivered files to different processing components based on file extension. A configuration table maps file extensions to numbered output ports. When a file is delivered (typically after uplink), the dispatcher examines its extension and forwards it to the appropriate handler. This allows different file types (e.g., sequences, parameter files, software updates) to be automatically routed to their respective processing components.
The File Worker provides an off-thread file I/O service for components that need to perform large or slow file operations without missing their timing deadlines. Components send file read or write requests to the File Worker, which executes them in its own thread and returns the results. This decouples file I/O latency from rate group execution.