diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-11-20 13:40:12 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-11-20 13:40:12 +0800 |
| commit | 8b70533434d86f72a9a62d79f0f447a619e25040 (patch) | |
| tree | 486d48bc091a590412181c416b8da58ca8f62062 /crates | |
| parent | 54bdb27af49788ca4562a72510f3b81278cb133f (diff) | |
Rename MemberHeld to LatestFileData and add version tracking
The struct now tracks both file holding status and latest file versions
for permission validation and update checks.
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/vcs_data/src/data/local/latest_file_data.rs (renamed from crates/vcs_data/src/data/local/member_held.rs) | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/vcs_data/src/data/local/member_held.rs b/crates/vcs_data/src/data/local/latest_file_data.rs index 3f07232..f737650 100644 --- a/crates/vcs_data/src/data/local/member_held.rs +++ b/crates/vcs_data/src/data/local/latest_file_data.rs @@ -6,18 +6,24 @@ use serde::{Deserialize, Serialize}; use crate::{ constants::{CLIENT_FILE_MEMBER_HELD, CLIENT_FILE_MEMBER_HELD_NOSET}, current::current_local_path, - data::{member::MemberId, vault::virtual_file::VirtualFileId}, + data::{ + member::MemberId, + vault::virtual_file::{VirtualFileId, VirtualFileVersion}, + }, }; const ACCOUNT: &str = "{account}"; -/// # Member Held Information -/// Records the files held by the member, used for permission validation +/// # Latest file data +/// Records the file holder and the latest version for permission and update checks #[derive(Debug, Default, Clone, Serialize, Deserialize, ConfigFile)] #[cfg_file(path = CLIENT_FILE_MEMBER_HELD_NOSET)] -pub struct MemberHeld { +pub struct LatestFileData { /// File holding status held_status: HashMap<VirtualFileId, HeldStatus>, + + /// File version + versions: HashMap<VirtualFileId, VirtualFileVersion>, } #[derive(Debug, Default, Clone, Serialize, Deserialize)] @@ -29,7 +35,7 @@ pub enum HeldStatus { WantedToKnow, // Holding status is unknown, notify server must inform client } -impl MemberHeld { +impl LatestFileData { /// Get the path to the file holding the held status information for the given member. pub fn held_file_path(account: &MemberId) -> Result<PathBuf, std::io::Error> { let Some(local_path) = current_local_path() else { |
