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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
use super::def::*;
use super::output_request::*;
use crate::{RequestSourceInfo, GlobalStateCategory};
use cyfs_base::*;
use std::sync::Arc;
#[async_trait::async_trait]
pub trait GlobalStateMetaOutputProcessor: Sync + Send + 'static {
async fn add_access(
&self,
req: GlobalStateMetaAddAccessOutputRequest,
) -> BuckyResult<GlobalStateMetaAddAccessOutputResponse>;
async fn remove_access(
&self,
req: GlobalStateMetaRemoveAccessOutputRequest,
) -> BuckyResult<GlobalStateMetaRemoveAccessOutputResponse>;
async fn clear_access(
&self,
req: GlobalStateMetaClearAccessOutputRequest,
) -> BuckyResult<GlobalStateMetaClearAccessOutputResponse>;
async fn add_link(
&self,
req: GlobalStateMetaAddLinkOutputRequest,
) -> BuckyResult<GlobalStateMetaAddLinkOutputResponse>;
async fn remove_link(
&self,
req: GlobalStateMetaRemoveLinkOutputRequest,
) -> BuckyResult<GlobalStateMetaRemoveLinkOutputResponse>;
async fn clear_link(
&self,
req: GlobalStateMetaClearLinkOutputRequest,
) -> BuckyResult<GlobalStateMetaClearLinkOutputResponse>;
async fn add_object_meta(
&self,
req: GlobalStateMetaAddObjectMetaOutputRequest,
) -> BuckyResult<GlobalStateMetaAddObjectMetaOutputResponse>;
async fn remove_object_meta(
&self,
req: GlobalStateMetaRemoveObjectMetaOutputRequest,
) -> BuckyResult<GlobalStateMetaRemoveObjectMetaOutputResponse>;
async fn clear_object_meta(
&self,
req: GlobalStateMetaClearObjectMetaOutputRequest,
) -> BuckyResult<GlobalStateMetaClearObjectMetaOutputResponse>;
async fn add_path_config(
&self,
req: GlobalStateMetaAddPathConfigOutputRequest,
) -> BuckyResult<GlobalStateMetaAddPathConfigOutputResponse>;
async fn remove_path_config(
&self,
req: GlobalStateMetaRemovePathConfigOutputRequest,
) -> BuckyResult<GlobalStateMetaRemovePathConfigOutputResponse>;
async fn clear_path_config(
&self,
req: GlobalStateMetaClearPathConfigOutputRequest,
) -> BuckyResult<GlobalStateMetaClearPathConfigOutputResponse>;
}
pub type GlobalStateMetaOutputProcessorRef = Arc<Box<dyn GlobalStateMetaOutputProcessor>>;
#[async_trait::async_trait]
pub trait GlobalStateMetaRawProcessor: Send + Sync {
async fn add_access(&self, item: GlobalStatePathAccessItem) -> BuckyResult<bool>;
async fn remove_access(
&self,
item: GlobalStatePathAccessItem,
) -> BuckyResult<Option<GlobalStatePathAccessItem>>;
async fn clear_access(&self) -> BuckyResult<usize>;
fn check_access<'d, 'a, 'b>(
&self,
req: GlobalStateAccessRequest<'d, 'a, 'b>,
) -> BuckyResult<()>;
async fn add_link(
&self,
source: &str,
target: &str,
) -> BuckyResult<bool>;
async fn remove_link(&self, source: &str) -> BuckyResult<Option<GlobalStatePathLinkItem>>;
async fn clear_link(&self) -> BuckyResult<usize>;
fn resolve_link(&self, source: &str) -> BuckyResult<Option<String>>;
async fn add_object_meta(&self, item: GlobalStateObjectMetaItem) -> BuckyResult<bool>;
async fn remove_object_meta(
&self,
item: GlobalStateObjectMetaItem,
) -> BuckyResult<Option<GlobalStateObjectMetaItem>>;
async fn clear_object_meta(&self) -> BuckyResult<usize>;
fn check_object_access(
&self,
target_dec_id: &ObjectId,
object_data: &dyn ObjectSelectorDataProvider,
source: &RequestSourceInfo,
permissions: AccessPermissions,
) -> BuckyResult<Option<()>>;
fn query_object_meta(
&self,
object_data: &dyn ObjectSelectorDataProvider,
) -> Option<GlobalStateObjectMetaConfigItemValue>;
async fn add_path_config(&self, item: GlobalStatePathConfigItem) -> BuckyResult<bool>;
async fn remove_path_config(
&self,
item: GlobalStatePathConfigItem,
) -> BuckyResult<Option<GlobalStatePathConfigItem>>;
async fn clear_path_config(&self) -> BuckyResult<usize>;
fn query_path_config(&self, path: &str) -> Option<GlobalStatePathConfigItemValue>;
}
pub type GlobalStateMetaRawProcessorRef = Arc<Box<dyn GlobalStateMetaRawProcessor>>;
#[async_trait::async_trait]
pub trait GlobalStateMetaManagerRawProcessor: Send + Sync {
async fn get_global_state_meta(
&self,
dec_id: &ObjectId,
category: GlobalStateCategory,
auto_create: bool,
) -> BuckyResult<Option<GlobalStateMetaRawProcessorRef>>;
}
pub type GlobalStateMetaManagerRawProcessorRef = Arc<Box<dyn GlobalStateMetaManagerRawProcessor>>;