cyfs_lib/storage/
remote_storage.rs1use cyfs_base::DeviceId;
2use super::collection::*;
3use super::remote_noc::*;
4use crate::stack::*;
5
6pub struct RemoteNOCStorage;
7
8impl RemoteNOCStorage {
9 pub fn new_noc_collection<T>(id: &str, stack: &SharedCyfsStack) -> NOCCollection<T>
10 where
11 T: Default + CollectionCodec<T> + Send + 'static,
12 {
13 let remote_noc = RemoteNamedObjectCache::new(
14 stack.non_service().clone_processor(),
15 &stack.local_device_id(),
16 );
17 NOCCollection::new(id, remote_noc.into_noc())
18 }
19
20 pub fn new_noc_collection_sync<T>(id: &str, stack: &SharedCyfsStack) -> NOCCollectionSync<T>
21 where
22 T: Default + CollectionCodec<T> + Send + 'static,
23 {
24 let remote_noc = RemoteNamedObjectCache::new(
25 stack.non_service().clone_processor(),
26 &stack.local_device_id(),
27 );
28 NOCCollectionSync::new(id, remote_noc.into_noc())
29 }
30
31 pub fn new_noc_collection_sync_uni<T>(id: &str, stack: &UniCyfsStackRef, device_id: &DeviceId) -> NOCCollectionSync<T>
32 where
33 T: Default + CollectionCodec<T> + Send + 'static,
34 {
35 let remote_noc = RemoteNamedObjectCache::new(
36 stack.non_service().clone(),
37 device_id,
38 );
39 NOCCollectionSync::new(id, remote_noc.into_noc())
40 }
41
42 pub fn new_noc_collection_rw_sync<T>(
43 id: &str,
44 stack: &SharedCyfsStack,
45 ) -> NOCCollectionRWSync<T>
46 where
47 T: Default + CollectionCodec<T> + Send + Sync + 'static,
48 {
49 let remote_noc = RemoteNamedObjectCache::new(
50 stack.non_service().clone_processor(),
51 &stack.local_device_id(),
52 );
53 NOCCollectionRWSync::new(id, remote_noc.into_noc())
54 }
55}