summaryrefslogtreecommitdiff
path: root/crates/vcs/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/vcs/src')
-rw-r--r--crates/vcs/src/data/sheet.rs9
-rw-r--r--crates/vcs/src/data/vault/sheets.rs18
-rw-r--r--crates/vcs/src/lib.rs2
-rw-r--r--crates/vcs/src/service.rs2
-rw-r--r--crates/vcs/src/service/server_entry.rs0
-rw-r--r--crates/vcs/src/service/standard_handle.rs16
6 files changed, 43 insertions, 4 deletions
diff --git a/crates/vcs/src/data/sheet.rs b/crates/vcs/src/data/sheet.rs
index a6765c0..95599ff 100644
--- a/crates/vcs/src/data/sheet.rs
+++ b/crates/vcs/src/data/sheet.rs
@@ -71,6 +71,15 @@ impl<'a> Sheet<'a> {
&self.data.inputs
}
+ /// Get the names of the inputs of this sheet
+ pub fn input_names(&self) -> Vec<String> {
+ self.data
+ .inputs
+ .iter()
+ .map(|input| input.name.clone())
+ .collect()
+ }
+
/// Get the mapping of this sheet
pub fn mapping(&self) -> &HashMap<SheetPathBuf, VirtualFileId> {
&self.data.mapping
diff --git a/crates/vcs/src/data/vault/sheets.rs b/crates/vcs/src/data/vault/sheets.rs
index 082c076..0bba4f5 100644
--- a/crates/vcs/src/data/vault/sheets.rs
+++ b/crates/vcs/src/data/vault/sheets.rs
@@ -154,6 +154,9 @@ impl Vault {
/// and will not be used in the future.
///
/// For a safer deletion method, consider using `delete_sheet_safety`.
+ ///
+ /// Note: This function is intended for server-side use only and should not be
+ /// arbitrarily called by other members to prevent unauthorized data deletion.
pub async fn delete_sheet(&self, sheet_name: &SheetName) -> Result<(), std::io::Error> {
let sheet_name = snake_case!(sheet_name.clone());
@@ -174,11 +177,18 @@ impl Vault {
/// Safely delete the sheet
///
- /// The sheet will be moved to the trash directory, ensuring it does not appear in the results of `sheets` and `sheet_names` methods.
- /// However, if the sheet's holder attempts to access the sheet through the `sheet` method, the system will automatically restore it from the trash directory.
- /// This means: the sheet will only permanently remain in the trash directory, waiting for manual cleanup by an administrator, when it is truly no longer in use.
+ /// The sheet will be moved to the trash directory, ensuring it does not appear in the
+ /// results of `sheets` and `sheet_names` methods.
+ /// However, if the sheet's holder attempts to access the sheet through the `sheet` method,
+ /// the system will automatically restore it from the trash directory.
+ /// This means: the sheet will only permanently remain in the trash directory,
+ /// waiting for manual cleanup by an administrator, when it is truly no longer in use.
+ ///
+ /// This is a safer deletion method because it provides the possibility of recovery,
+ /// avoiding irreversible data loss caused by accidental deletion.
///
- /// This is a safer deletion method because it provides the possibility of recovery, avoiding irreversible data loss caused by accidental deletion.
+ /// Note: This function is intended for server-side use only and should not be
+ /// arbitrarily called by other members to prevent unauthorized data deletion.
pub async fn delete_sheet_safely(&self, sheet_name: &SheetName) -> Result<(), std::io::Error> {
let sheet_name = snake_case!(sheet_name.clone());
diff --git a/crates/vcs/src/lib.rs b/crates/vcs/src/lib.rs
index 1b41391..9a84b4d 100644
--- a/crates/vcs/src/lib.rs
+++ b/crates/vcs/src/lib.rs
@@ -3,3 +3,5 @@ pub mod current;
#[allow(dead_code)]
pub mod data;
+
+pub mod service;
diff --git a/crates/vcs/src/service.rs b/crates/vcs/src/service.rs
new file mode 100644
index 0000000..53365b8
--- /dev/null
+++ b/crates/vcs/src/service.rs
@@ -0,0 +1,2 @@
+pub mod server_entry;
+pub mod standard_handle;
diff --git a/crates/vcs/src/service/server_entry.rs b/crates/vcs/src/service/server_entry.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crates/vcs/src/service/server_entry.rs
diff --git a/crates/vcs/src/service/standard_handle.rs b/crates/vcs/src/service/standard_handle.rs
new file mode 100644
index 0000000..0d898b0
--- /dev/null
+++ b/crates/vcs/src/service/standard_handle.rs
@@ -0,0 +1,16 @@
+use tcp_connection::handle::{ClientHandle, ServerHandle};
+
+pub struct StandardClientHandle;
+pub struct StandardServerHandle;
+
+impl ClientHandle<StandardServerHandle> for StandardClientHandle {
+ async fn process(instance: tcp_connection::instance::ConnectionInstance) {
+ todo!()
+ }
+}
+
+impl ServerHandle<StandardClientHandle> for StandardServerHandle {
+ async fn process(instance: tcp_connection::instance::ConnectionInstance) {
+ todo!()
+ }
+}