-
Notifications
You must be signed in to change notification settings - Fork 0
Update dataStorage proto file in order to add some more rpc calls #38
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
Open
mhmeraji
wants to merge
2
commits into
master
Choose a base branch
from
dataStorage
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,326 @@ | ||
syntax = "proto3"; | ||
|
||
package data_storage; | ||
|
||
|
||
// Interface exported by the server. | ||
service DataStorage { | ||
// A simple RPC used for registering new users. | ||
// username is obtained from input and the result will be | ||
// successful if the username isn't already taken. | ||
// username shouldn't contain whitespace or *, ?, $, ', ", etc characters. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc RegisterUser (RegisterUserRequest) returns (RegisterUserResponse); | ||
|
||
// A simple RPC used for removing old users. | ||
// successful if the username is already registered. | ||
// In case of failure a proper message will be returned. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc DeregisterUser(DeregisterUserRequest) returns (DeregisterUserResponse); | ||
|
||
// A simple RPC used for setting the volume limit | ||
// for a specified username. | ||
// Request will be failed if the username doesn't exist or | ||
// the requested volume is less than the used volume of the user. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc SetVolume (SetVolumeRequest) returns (SetVolumeResponse); | ||
|
||
// A simple RPC used for getting the amount of used, total and remaing | ||
// volume for the specified username. | ||
// request will fail if the username isn't registered. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc GetVolumeReport (GetVolumeRequest) returns (GetVolumeResponse); | ||
|
||
// A simple RPC used for creating a new folder in the specified path | ||
// for the spcified useranme | ||
// fails if: | ||
// - username isn't registered | ||
// - the path can't be reached(missing folder between the path) | ||
// - the destination folder contains a folder with the same name. | ||
// - the folder name is recycleBin and the path is /username | ||
// if successful a boolean and the new path for folder is returened. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc CreateFolder (CreateFolderRequest) returns (CreateFolderResponse); | ||
|
||
// A simple RPC used for deleting a content in the specified path | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// for the specified username. | ||
// fails if: | ||
// - username isn't registered | ||
// - the specified path doesn't exist | ||
// - the specified folder is not empty. | ||
// - the user doesn't have access to this path | ||
// - the user tries to remove recycleBin or base folder | ||
// if succesful, a true boolean is returened. | ||
// NOTE that the removed file or folder will be stored in recycleBin. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc Remove (RemoveRequest) returns (RemoveResponse); | ||
|
||
// A simple RPC used for deleting a content in the specified path | ||
// for the specified username. | ||
// fails if: | ||
// - username isn't registered | ||
// - the specified path doesn't exist | ||
// - the user doesn't have access to this path | ||
// - the user tries to remove recycleBin or base folder | ||
// if succesful, a true boolean is returened. | ||
// NOTE that the different between Remove and ForceRemove is that | ||
// ForceRemove can remove the folder with other contents in it and | ||
// the removed folder will be in recycleBin with its contents as | ||
// structured as before. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc ForceRemove (ForceRemoveRequest) returns (ForceRemoveResponse); | ||
|
||
// A simple RPC used for emptying the recycleBin folder | ||
// for the specified username. | ||
// fails if username isn't registered. | ||
// if successful, a true boolean will be returned. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc EmptyRecycleBin (EmptyRecycleBinRequest) returns (EmptyRecycleBinResponse); | ||
|
||
// A simple RPC used for browsing the data of the specified username. | ||
// obtains the base path and username from the input and | ||
// returns the list of files and folders created in the base path. | ||
// fails if the username or the base path are not correct. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc BrowseData (BrowseDataRequest) returns (BrowseDataResponse); | ||
|
||
// A simple RPC used for check if a specified folder or file is uploaded | ||
// for the specified user. | ||
// fails if: | ||
// - the user is not registered. | ||
// if successful the path of the file or folder is returned | ||
// and if the content doesn't exist in the user's filesystem, | ||
// an empty path will be returned. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc Search (SearchRequest) returns (SearchResponse); | ||
|
||
// A simple RPC used for getting the report of the general disk usage of the system.. | ||
// no input is required. | ||
// result contains the status of the system. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc GetSystemicReport (GetSystemicReportRequest) returns (GetSystemicReportResponse); | ||
|
||
// A simple rpc used for copying a path from a source to a destination. | ||
// fails if: | ||
// - the username isn't registered prior to the action. | ||
// - the source or destination path doesn't exist in the user's filesystem. | ||
// - the username doesn't have access to the source or destination path. | ||
// - there isn't enough space for the copying action to be completed. | ||
// - the destination path basename is a file. | ||
// - source and destination paths point at the same place. | ||
// - a content with same name exists in the destination path. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc Copy (CopyRequest) returns (CopyResponse); | ||
|
||
// A simple rpc used for cutting a path from a source and pasting it to a destination. | ||
// fails if: | ||
// - the username isn't registered prior to the action. | ||
// - the source or destination path doesn't exist in the user's filesystem. | ||
// - the username doesn't have access to the source or destination path. | ||
// - there isn't enough space for the copying action to be completed. | ||
// - the destination path basename is a file. | ||
// - source and destination paths point at the same place. | ||
// - a content with same name exists in the destination path. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc Cut (CutRequest) returns (CutResponse); | ||
|
||
// A simple rpc used for the size of the specified paths in bytes. | ||
// fails if: | ||
// - the username isn't registered. | ||
// - the spcified path doesn't exists. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc GetPathSize(GetPathSizeRequest) returns (GetPathSizeResponse); | ||
|
||
// A simple rpc used for getting the userTree. | ||
// user tree is a string which resembles the structure of the filesystem | ||
// for the specified user. | ||
// fails if: | ||
// - the username isn't registered. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc GetUserTree(GetUserTreeRequest) returns (GetUserTreeResponse); | ||
|
||
// A server-to-client RPC, used for downloading the specified file. | ||
// The following content should be provided for data download. | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// - username | ||
// - path | ||
// - file_name | ||
// - extension | ||
// A byte stream which contains the file will be returned if all the above | ||
// information is correctly specified. | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
rpc DownloadFile (DownloadFileRequest) returns (stream DownloadFileResponse); | ||
|
||
// A client-to-server RPC, used for uploading the input data into the system. | ||
// obtains file metadata and chunk_bytes from input stream and returns | ||
// the path in which the data is stored (virtual path of the user). | ||
// In case of the failure the rpc call is aborted and a proper message is shown to user. | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
rpc UploadFile (stream UploadFileRequest) returns (UploadFileResponse); | ||
} | ||
|
||
|
||
message RegisterUserRequest { | ||
string username = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
int64 initial_volume = 2; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message RegisterUserResponse { | ||
string registered_username = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message DeregisterUserRequest{ | ||
string username = 1; | ||
} | ||
|
||
message DeregisterUserResponse{ | ||
string deregistered_username = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message SetVolumeRequest { | ||
string username = 1; | ||
int64 new_volume = 2; | ||
} | ||
|
||
message SetVolumeResponse { | ||
string newly_set_volume = 1; | ||
} | ||
|
||
message GetVolumeRequest { | ||
string username = 1; | ||
} | ||
|
||
message VolumeReport { | ||
int64 total_allocated_volume = 1; | ||
int64 total_used_volume = 2; | ||
int64 remaining_volume = 3; | ||
} | ||
|
||
message GetVolumeResponse { | ||
VolumeReport volume_report = 1; | ||
} | ||
|
||
message CreateFolderRequest { | ||
string username = 1; | ||
string folder_name = 2; | ||
string path = 3; | ||
} | ||
|
||
message CreateFolderResponse { | ||
string path = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message RemoveRequest { | ||
string username = 1; | ||
string path = 2; | ||
} | ||
|
||
message RemoveResponse { | ||
string removed_path = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message ForceRemoveRequest { | ||
string username = 1; | ||
string path = 2; | ||
} | ||
|
||
message ForceRemoveResponse { | ||
string force_removed_path = 1; | ||
} | ||
|
||
message EmptyRecycleBinRequest { | ||
string username = 1; | ||
} | ||
|
||
message EmptyRecycleBinResponse { | ||
int64 total_used_volume = 1; | ||
} | ||
|
||
message BrowseDataRequest { | ||
string username = 1; | ||
string path = 2; | ||
} | ||
|
||
message BrowseDataResponse { | ||
repeated string contents = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message SearchRequest { | ||
string username = 1; | ||
string content = 2; | ||
} | ||
|
||
message SearchResponse { | ||
string path = 1; | ||
string content_type = 2; | ||
} | ||
|
||
message GetSystemicReportRequest {} | ||
|
||
message GetSystemicReportResponse { | ||
int64 number_of_users = 1; | ||
VolumeReport volume_report = 2; | ||
} | ||
|
||
message MetaData { | ||
string username = 1; | ||
string path = 2; | ||
string filename = 3; | ||
string extension = 4; | ||
int64 file_size = 5; | ||
} | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
message CopyRequest { | ||
string username = 1; | ||
string source_path = 2; | ||
string destination_path = 3; | ||
} | ||
|
||
message CopyResponse { | ||
int64 new_usded_volume = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message CutRequest { | ||
string username = 1; | ||
string source_path = 2; | ||
string destination_path = 3; | ||
} | ||
|
||
message CutResponse { | ||
int64 new_used_volume = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. مگه با کات و پیست حجم عوض میشه؟ |
||
} | ||
|
||
message GetPathSizeRequest { | ||
string username = 1; | ||
string path = 2; | ||
} | ||
|
||
message GetPathSizeResponse { | ||
int64 size_in_bytes = 1; | ||
} | ||
|
||
message GetUserTreeRequest { | ||
string username = 1; | ||
} | ||
|
||
message GetUserTreeResponse { | ||
string user_tree = 1; | ||
} | ||
|
||
message DownloadFileRequest { | ||
string username = 1; | ||
string path = 2; | ||
} | ||
|
||
message DownloadFileResponse { | ||
bytes chunk_data = 1; | ||
} | ||
|
||
message UploadFileRequest { | ||
oneof request { | ||
MetaData metadata = 1; | ||
bytes chunk_data = 2; | ||
} | ||
} | ||
|
||
message UploadFileResponse { | ||
string path = 1; | ||
mhmeraji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.