Build a Data Storage API
Budget: ₹1,500 – ₹12,500 INR
Objective
In this section you need to implement a file data storage solution with an API for creation, deletion, selective edition, querying and fetching.
Data generation
You may use any programming language you prefer to write your code. You are given a python 3 script to generate data, generate_rand_file.py.(will provide later on). The command line parameters are as follows:
Keyword Description
string-A space-separated string to include chunks of at random places in the generated file
files_directory-The directory path for the generated file to be written into
The script generates a ~10MB text file containing a random string including spaces but no line breaks.
Requirements
The API you create will be tested with a scenario of commands that will be given later.
Your API functionalities:
1. Add a file to the storage given its name and content
2. Delete a file given its name
3. Retrieve a file given its name (bonus: pretty print the retrieved file content)
4. Count the number of occurrences of ‘Welcome’, ‘to’ and ‘Cloud’ in a file given its name.
5. Count the number of occurrences of a string S in a file, given S and the file name.
6. Mark a file as ‘outdated’
7. List ‘outdated’ files
Bonus:
1. Lock or unlock a file given its name. A file that is locked can not be accessed by any other process but the process owning the lock
2. Get a file status given its name. The status is one of ‘opened for reading’, ‘opened for writing’, ‘closed’
Test scenarios
In order to test your API, you’ll be asked to go through a sequence of calls to the functionalities. Following is an example of such a scenario:
1. Create 100 files, using the given script, omitting the string argument
2. Add the generated files to the storage
3. Delete one of the file in the storage
4. Print the content of a file F in the storage
5. Print the count of occurrence's of ‘Cloud’ in F
6. Create 1 file, using the given script, with string=’a random string’
7. Add the generated file to the storage
8. Print the count of occurrences of ‘random’ in the newest file
9. Mark file F as ‘outdated’
10. Print the name of all the ‘outdated’ files in the storage
In this section you need to implement a file data storage solution with an API for creation, deletion, selective edition, querying and fetching.
Data generation
You may use any programming language you prefer to write your code. You are given a python 3 script to generate data, generate_rand_file.py.(will provide later on). The command line parameters are as follows:
Keyword Description
string-A space-separated string to include chunks of at random places in the generated file
files_directory-The directory path for the generated file to be written into
The script generates a ~10MB text file containing a random string including spaces but no line breaks.
Requirements
The API you create will be tested with a scenario of commands that will be given later.
Your API functionalities:
1. Add a file to the storage given its name and content
2. Delete a file given its name
3. Retrieve a file given its name (bonus: pretty print the retrieved file content)
4. Count the number of occurrences of ‘Welcome’, ‘to’ and ‘Cloud’ in a file given its name.
5. Count the number of occurrences of a string S in a file, given S and the file name.
6. Mark a file as ‘outdated’
7. List ‘outdated’ files
Bonus:
1. Lock or unlock a file given its name. A file that is locked can not be accessed by any other process but the process owning the lock
2. Get a file status given its name. The status is one of ‘opened for reading’, ‘opened for writing’, ‘closed’
Test scenarios
In order to test your API, you’ll be asked to go through a sequence of calls to the functionalities. Following is an example of such a scenario:
1. Create 100 files, using the given script, omitting the string argument
2. Add the generated files to the storage
3. Delete one of the file in the storage
4. Print the content of a file F in the storage
5. Print the count of occurrence's of ‘Cloud’ in F
6. Create 1 file, using the given script, with string=’a random string’
7. Add the generated file to the storage
8. Print the count of occurrences of ‘random’ in the newest file
9. Mark file F as ‘outdated’
10. Print the name of all the ‘outdated’ files in the storage