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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use crate::GlobalStateCategory;
use super::output_request::*;
use cyfs_base::*;
use std::sync::Arc;
#[async_trait::async_trait]
pub trait GlobalStateOutputProcessor: Sync + Send + 'static {
fn get_category(&self) -> GlobalStateCategory;
async fn get_current_root(
&self,
req: RootStateGetCurrentRootOutputRequest,
) -> BuckyResult<RootStateGetCurrentRootOutputResponse>;
async fn create_op_env(
&self,
req: RootStateCreateOpEnvOutputRequest,
) -> BuckyResult<OpEnvOutputProcessorRef>;
}
pub type GlobalStateOutputProcessorRef = Arc<Box<dyn GlobalStateOutputProcessor>>;
#[async_trait::async_trait]
pub trait OpEnvOutputProcessor: Sync + Send + 'static {
fn get_sid(&self) -> u64;
fn get_category(&self) -> GlobalStateCategory;
async fn load(&self, req: OpEnvLoadOutputRequest) -> BuckyResult<()>;
async fn load_by_path(&self, req: OpEnvLoadByPathOutputRequest) -> BuckyResult<()>;
async fn create_new(&self, req: OpEnvCreateNewOutputRequest) -> BuckyResult<()>;
async fn get_current_root(
&self,
req: OpEnvGetCurrentRootOutputRequest,
) -> BuckyResult<OpEnvGetCurrentRootOutputResponse>;
async fn lock(&self, req: OpEnvLockOutputRequest) -> BuckyResult<()>;
async fn commit(&self, req: OpEnvCommitOutputRequest)
-> BuckyResult<OpEnvCommitOutputResponse>;
async fn abort(&self, req: OpEnvAbortOutputRequest) -> BuckyResult<()>;
async fn metadata(
&self,
req: OpEnvMetadataOutputRequest,
) -> BuckyResult<OpEnvMetadataOutputResponse>;
async fn get_by_key(
&self,
req: OpEnvGetByKeyOutputRequest,
) -> BuckyResult<OpEnvGetByKeyOutputResponse>;
async fn insert_with_key(&self, req: OpEnvInsertWithKeyOutputRequest) -> BuckyResult<()>;
async fn set_with_key(
&self,
req: OpEnvSetWithKeyOutputRequest,
) -> BuckyResult<OpEnvSetWithKeyOutputResponse>;
async fn remove_with_key(
&self,
req: OpEnvRemoveWithKeyOutputRequest,
) -> BuckyResult<OpEnvRemoveWithKeyOutputResponse>;
async fn contains(
&self,
req: OpEnvContainsOutputRequest,
) -> BuckyResult<OpEnvContainsOutputResponse>;
async fn insert(&self, req: OpEnvInsertOutputRequest)
-> BuckyResult<OpEnvInsertOutputResponse>;
async fn remove(&self, req: OpEnvRemoveOutputRequest)
-> BuckyResult<OpEnvRemoveOutputResponse>;
async fn next(&self, req: OpEnvNextOutputRequest) -> BuckyResult<OpEnvNextOutputResponse>;
async fn reset(&self, req: OpEnvResetOutputRequest) -> BuckyResult<()>;
async fn list(&self, req: OpEnvListOutputRequest) -> BuckyResult<OpEnvListOutputResponse>;
}
pub type OpEnvOutputProcessorRef = Arc<Box<dyn OpEnvOutputProcessor>>;
#[async_trait::async_trait]
pub trait GlobalStateAccessorOutputProcessor: Sync + Send + 'static {
async fn get_object_by_path(
&self,
req: RootStateAccessorGetObjectByPathOutputRequest,
) -> BuckyResult<RootStateAccessorGetObjectByPathOutputResponse>;
async fn list(
&self,
req: RootStateAccessorListOutputRequest,
) -> BuckyResult<RootStateAccessorListOutputResponse>;
}
pub type GlobalStateAccessorOutputProcessorRef = Arc<Box<dyn GlobalStateAccessorOutputProcessor>>;