1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use super::collection::*;
use super::remote_noc::*;
use crate::stack::*;

pub struct RemoteNOCStorage;

impl RemoteNOCStorage {
    pub fn new_noc_collection<T>(id: &str, stack: &SharedCyfsStack) -> NOCCollection<T>
    where
        T: Default + CollectionCodec<T> + Send + 'static,
    {
        let remote_noc = RemoteNamedObjectCache::new(
            stack.non_service().clone_processor(),
            &stack.local_device_id(),
        );
        NOCCollection::new(id, remote_noc.into_noc())
    }

    pub fn new_noc_collection_sync<T>(id: &str, stack: &SharedCyfsStack) -> NOCCollectionSync<T>
    where
        T: Default + CollectionCodec<T> + Send + 'static,
    {
        let remote_noc = RemoteNamedObjectCache::new(
            stack.non_service().clone_processor(),
            &stack.local_device_id(),
        );
        NOCCollectionSync::new(id, remote_noc.into_noc())
    }

    pub fn new_noc_collection_rw_sync<T>(
        id: &str,
        stack: &SharedCyfsStack,
    ) -> NOCCollectionRWSync<T>
    where
        T: Default + CollectionCodec<T> + Send + Sync + 'static,
    {
        let remote_noc = RemoteNamedObjectCache::new(
            stack.non_service().clone_processor(),
            &stack.local_device_id(),
        );
        NOCCollectionRWSync::new(id, remote_noc.into_noc())
    }
}