mirror of
https://github.com/OMGeeky/gdriver2.git
synced 2026-02-23 15:38:32 +01:00
expand service
This commit is contained in:
@@ -15,6 +15,86 @@ struct GdriverServer {
|
|||||||
drive: Arc<Mutex<Drive>>,
|
drive: Arc<Mutex<Drive>>,
|
||||||
}
|
}
|
||||||
impl GDriverService for GdriverServer {
|
impl GDriverService for GdriverServer {
|
||||||
|
async fn get_file_by_path(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
path: PathBuf,
|
||||||
|
) -> StdResult<DriveId, GetFileByPathError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn write_local_change(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<(), WriteLocalChangeError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn get_metadata_for_file(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<(), GetMetadataError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn download_content_for_file(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<(), GetContentError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn list_files_in_directory(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<(), GetFileListError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn mark_file_as_deleted(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<(), MarkFileAsDeletedError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn mark_file_for_keeping_local(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<(), MarkFileForKeepingLocalError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn unmark_file_for_keeping_local(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<(), UnmarkFileForKeepingLocalError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc = " Returns true if the file was had remote changes and was updadet"]
|
||||||
|
async fn update_changes_for_file(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
id: DriveId,
|
||||||
|
) -> StdResult<bool, UpdateChangesError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn update_changes(
|
||||||
|
self,
|
||||||
|
context: ::tarpc::context::Context,
|
||||||
|
) -> StdResult<(), UpdateChangesError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
async fn do_something2(
|
async fn do_something2(
|
||||||
self,
|
self,
|
||||||
_: ::tarpc::context::Context,
|
_: ::tarpc::context::Context,
|
||||||
@@ -51,30 +131,6 @@ impl GDriverService for GdriverServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_file_by_path(
|
|
||||||
self,
|
|
||||||
context: ::tarpc::context::Context,
|
|
||||||
path: PathBuf,
|
|
||||||
) -> StdResult<DriveId, GetFileByPathError> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc = " Returns true if the file was had remote changes and was updadet"]
|
|
||||||
async fn update_changes_for_file(
|
|
||||||
self,
|
|
||||||
context: ::tarpc::context::Context,
|
|
||||||
id: DriveId,
|
|
||||||
) -> StdResult<bool, UpdateChangesError> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn update_changes(
|
|
||||||
self,
|
|
||||||
context: ::tarpc::context::Context,
|
|
||||||
) -> StdResult<(), UpdateChangesError> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
async fn long_running_task(drive: &Arc<Mutex<Drive>>) {
|
async fn long_running_task(drive: &Arc<Mutex<Drive>>) {
|
||||||
thread::sleep(Duration::seconds(10).to_std().unwrap());
|
thread::sleep(Duration::seconds(10).to_std().unwrap());
|
||||||
|
|||||||
@@ -8,6 +8,17 @@ use crate::drive_structure::drive_id::DriveId;
|
|||||||
#[tarpc::service]
|
#[tarpc::service]
|
||||||
pub trait GDriverService {
|
pub trait GDriverService {
|
||||||
async fn get_file_by_path(path: PathBuf) -> StdResult<DriveId, GetFileByPathError>;
|
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
|
/// 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_for_file(id: DriveId) -> StdResult<bool, UpdateChangesError>;
|
||||||
async fn update_changes() -> StdResult<(), UpdateChangesError>;
|
async fn update_changes() -> StdResult<(), UpdateChangesError>;
|
||||||
@@ -31,3 +42,24 @@ pub enum BackendActionError {
|
|||||||
pub enum GetFileByPathError {}
|
pub enum GetFileByPathError {}
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub enum UpdateChangesError {}
|
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 {}
|
||||||
|
|||||||
Reference in New Issue
Block a user