Skip to content

[FEATURE]: add an interface for file storage #9

@Narayanbhat166

Description

@Narayanbhat166

The code files that are retrieved from the leetcode servers are to be stored in a system. Since we are just storing and retrieving the files as it, this need not be stored in a file system. Also the access patterns and the way in which these files are stored as a flat structure instead of a hierarchical one defeat the purpose of storing these files in a file system. The usual procedure is as follows

  • Retrieve the code data of a submission
  • Hash the code to find duplicate entries ( yes, there are people who just submit the same code )
  • Store the hash code in a database if the hash does not already exist.

The file storage interface should have two methods

async fn store_file(&self, file_contents: String, file_name: String) -> Result<(), FileStorageInterfaceError>;
async fn get_file(&self, file_name: String) -> Result<String, FileStorageInterfaceError>;

This interface can be implemented for many backends. For example the files can be stored in a discord server, or on a telegram server. There can be a local database which maintains mapping of where a particular file is being stored.

The files can also be batched and then stored in order to make the storage efficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions