Skip to content

Commit

Permalink
GDS: FileManager skeleton added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor Colombo committed Mar 2, 2023
1 parent b301742 commit 45380b8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
Empty file.
27 changes: 27 additions & 0 deletions Apps/GroundSoftware/IrisBackendv3/codec/files/file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from typing import TypeAlias, Dict, List, Final, ClassVar

from dataclasses import dataclass

from ..payload import FileMetadata, FileBlockPayload

HashedId: TypeAlias = int

class File:
_FILE_EXT: ClassVar[str] = '.iris.hex'

_metadata: FileMetadata

_blocks: Dict[int, FileBlockPayload]

@property
def hashedId(self) -> HashedId:
return self._metadata.hashedId

def ingest_block(block: FileBlockPayload) -> None:
pass

def generate_file_contents() -> bytes:
# TODO: Make a cached property?
pass

def save_file(self, path: str)
15 changes: 15 additions & 0 deletions Apps/GroundSoftware/IrisBackendv3/codec/files/file_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from typing import TypeAlias, Dict, List

from .file import File, HashedId
from ..packet import Packet

class FileManager:
in_progress_files: Dict[HashedId, File]

def process_packet(packet: Packet) -> bool:
""" Extracts any file blocks from the given packet and uses them to
build or continue building a file.
"""
raise NotImplementedError()

def save_all_files()
7 changes: 7 additions & 0 deletions Apps/GroundSoftware/IrisBackendv3/codec/files/image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .file import File

class Image(File):
# override save

def to_b64(self) -> str:
pass

0 comments on commit 45380b8

Please sign in to comment.