rename src-tauri -> src
This commit is contained in:
parent
b7b70fe22d
commit
500da04ce7
55 changed files with 11 additions and 5277 deletions
25
src/fs/remote.rs
Normal file
25
src/fs/remote.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Абстракция над RemoteFs для хранения активных соединений
|
||||
// TODO: HashMap<connection_id, Arc<dyn RemoteFs>>
|
||||
|
||||
use crate::protocols::RemoteFs;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct RemoteRegistry {
|
||||
connections: Mutex<HashMap<String, Arc<dyn RemoteFs>>>,
|
||||
}
|
||||
|
||||
impl RemoteRegistry {
|
||||
pub fn insert(&self, id: String, fs: Arc<dyn RemoteFs>) {
|
||||
self.connections.lock().unwrap().insert(id, fs);
|
||||
}
|
||||
|
||||
pub fn get(&self, id: &str) -> Option<Arc<dyn RemoteFs>> {
|
||||
self.connections.lock().unwrap().get(id).cloned()
|
||||
}
|
||||
|
||||
pub fn remove(&self, id: &str) {
|
||||
self.connections.lock().unwrap().remove(id);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue