From d104ee359c9b084705256cc6dd74a06a352c0f4e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 12 Oct 2025 18:16:46 +0800 Subject: feat: Update data configuration structures - Add new configuration fields for local and vault data - Remove outdated todo.txt file --- crates/vcs_data/src/data/local/config.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'crates/vcs_data/src/data/local') diff --git a/crates/vcs_data/src/data/local/config.rs b/crates/vcs_data/src/data/local/config.rs index 5444047..338d01b 100644 --- a/crates/vcs_data/src/data/local/config.rs +++ b/crates/vcs_data/src/data/local/config.rs @@ -5,6 +5,7 @@ use std::net::SocketAddr; use crate::constants::CLIENT_FILE_WORKSPACE; use crate::constants::PORT; use crate::data::member::MemberId; +use crate::data::vault::config::VaultUuid; #[derive(Serialize, Deserialize, ConfigFile)] #[cfg_file(path = CLIENT_FILE_WORKSPACE)] @@ -16,6 +17,14 @@ pub struct LocalConfig { /// The member ID used by the current local workspace. /// This ID will be used to verify access permissions when connecting to the upstream server. using_account: MemberId, + + /// Whether the local workspace is stained. + /// + /// If stained, it can only set an upstream server with the same identifier. + /// + /// If the value is None, it means not stained; + /// otherwise, it contains the stain identifier (i.e., the upstream vault's unique ID) + stained_uuid: Option, } impl Default for LocalConfig { @@ -26,6 +35,7 @@ impl Default for LocalConfig { PORT, )), using_account: "unknown".to_string(), + stained_uuid: None, } } } @@ -50,4 +60,19 @@ impl LocalConfig { pub fn current_account(&self) -> MemberId { self.using_account.clone() } + + /// Check if the local workspace is stained. + pub fn stained(&self) -> bool { + self.stained_uuid.is_some() + } + + /// Stain the local workspace with the given UUID. + pub fn stain(&mut self, uuid: VaultUuid) { + self.stained_uuid = Some(uuid); + } + + /// Unstain the local workspace. + pub fn unstain(&mut self) { + self.stained_uuid = None; + } } -- cgit