expand service

This commit is contained in:
OMGeeky
2024-02-17 18:08:36 +01:00
parent 9a6ff0f017
commit 6a615d8d35
2 changed files with 112 additions and 24 deletions

View File

@@ -8,6 +8,17 @@ use crate::drive_structure::drive_id::DriveId;
#[tarpc::service]
pub trait GDriverService {
async fn get_file_by_path(path: PathBuf) -> StdResult<DriveId, GetFileByPathError>;
async fn write_local_change(id: DriveId) -> StdResult<(), WriteLocalChangeError>;
async fn get_metadata_for_file(id: DriveId) -> StdResult<(), GetMetadataError>;
async fn download_content_for_file(id: DriveId) -> StdResult<(), GetContentError>;
async fn list_files_in_directory(id: DriveId) -> StdResult<(), GetFileListError>;
async fn mark_file_as_deleted(id: DriveId) -> StdResult<(), MarkFileAsDeletedError>;
async fn mark_file_for_keeping_local(
id: DriveId,
) -> StdResult<(), MarkFileForKeepingLocalError>;
async fn unmark_file_for_keeping_local(
id: DriveId,
) -> StdResult<(), UnmarkFileForKeepingLocalError>;
/// Returns true if the file was had remote changes and was updadet
async fn update_changes_for_file(id: DriveId) -> StdResult<bool, UpdateChangesError>;
async fn update_changes() -> StdResult<(), UpdateChangesError>;
@@ -31,3 +42,24 @@ pub enum BackendActionError {
pub enum GetFileByPathError {}
#[derive(Debug, Serialize, Deserialize)]
pub enum UpdateChangesError {}
#[derive(Debug, Serialize, Deserialize)]
pub enum WriteLocalChangeError {
RemoteChanged,
UnknownId,
NotAllowed,
Other,
}
#[derive(Debug, Serialize, Deserialize)]
pub enum GetMetadataError {}
#[derive(Debug, Serialize, Deserialize)]
pub enum GetContentError {}
//#[derive(Debug, Serialize, Deserialize)]
//pub enum GetContentError {}
#[derive(Debug, Serialize, Deserialize)]
pub enum GetFileListError {}
#[derive(Debug, Serialize, Deserialize)]
pub enum MarkFileAsDeletedError {}
#[derive(Debug, Serialize, Deserialize)]
pub enum MarkFileForKeepingLocalError {}
#[derive(Debug, Serialize, Deserialize)]
pub enum UnmarkFileForKeepingLocalError {}