Implement a FileStorage Library
You are tasked with implementing a library for managing file storage in a cloud-based application.
The library should allow users to upload, retrieve, and delete files efficiently. Additionally, the library should provide a way to list all files with metadata such as file size and upload timestamp.
Requirements
- Implement a class
FileStoragewith the following methods: upload_file(file_name: str, file_content: bytes) -> str- Uploads a file and returns a unique identifier for the file.
get_file(file_id: str) -> bytes- Retrieves the content of the file corresponding to the given identifier.
delete_file(file_id: str) -> bool- Deletes the file with the given identifier and returns whether the operation was successful.
list_files() -> List[Dict[str, Any]]- Returns a list of all files with metadata. Each file’s metadata should include:
file_id: The unique identifier of the file.file_name: The original name of the file.file_size: The size of the file in bytes.upload_timestamp: The time the file was uploaded.
This problem asks you to design an in-memory file storage service with fast upload, lookup, deletion, and listing operations. The natural approach is to store each file in a hash map keyed by `file_id`, along with metadata such as file name, byte size, and upload timestamp. The main challenge is keeping the API clean and ensuring each operation runs efficiently while returning the expected metadata format.