Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Narayanbhat166 opened this issue Jul 8, 2024 · 0 comments
Open

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

Narayanbhat166 opened this issue Jul 8, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@Narayanbhat166
Copy link
Owner

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.

@Narayanbhat166 Narayanbhat166 added the good first issue Good for newcomers label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant