Implement SMB Durable Handles (Phase 1): Persistent FileId + reconnect + expiration + cleanup
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

This commit is contained in:
Warren
2026-06-21 05:11:39 +08:00
parent b014390d12
commit 5238a84972
3 changed files with 445 additions and 1 deletions

View File

@@ -236,3 +236,44 @@ impl ShareBackend for NotSupportedBackend {
}
}
}
/// Null handle for testing purposes.
pub struct NullHandle;
#[async_trait]
impl Handle for NullHandle {
async fn read(&self, _offset: u64, _len: u32) -> SmbResult<bytes::Bytes> {
Err(SmbError::NotSupported)
}
async fn write(&self, _offset: u64, _data: &[u8]) -> SmbResult<u32> {
Err(SmbError::NotSupported)
}
async fn flush(&self) -> SmbResult<()> {
Err(SmbError::NotSupported)
}
async fn stat(&self) -> SmbResult<FileInfo> {
Ok(FileInfo {
name: String::new(),
end_of_file: 0,
allocation_size: 0,
creation_time: 0,
last_access_time: 0,
last_write_time: 0,
change_time: 0,
is_directory: false,
file_index: 0,
})
}
async fn set_times(&self, _times: FileTimes) -> SmbResult<()> {
Err(SmbError::NotSupported)
}
async fn truncate(&self, _len: u64) -> SmbResult<()> {
Err(SmbError::NotSupported)
}
async fn list_dir(&self, _pattern: Option<&str>) -> SmbResult<Vec<DirEntry>> {
Err(SmbError::NotSupported)
}
async fn close(self: Box<Self>) -> SmbResult<()> {
Ok(())
}
}