cyfs_lib/rmeta/
output_request.rs

1
2use super::def::*;
3use cyfs_base::*;
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Clone, Debug, Serialize, Deserialize)]
8pub struct MetaOutputRequestCommon {
9    // 来源DEC
10    pub dec_id: Option<ObjectId>,
11
12    // 目标DEC
13    pub target_dec_id: Option<ObjectId>,
14
15    // 用以默认行为
16    pub target: Option<ObjectId>,
17
18    pub flags: u32,
19}
20
21impl MetaOutputRequestCommon {
22    pub fn new() -> Self {
23        Self {
24            dec_id: None,
25            target_dec_id: None,
26            target: None,
27            flags: 0,
28        }
29    }
30}
31
32impl std::fmt::Display for MetaOutputRequestCommon {
33    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
34        if let Some(dec_id) = &self.dec_id {
35            write!(f, "dec_id: {}", dec_id)?;
36        }
37        if let Some(target_dec_id) = &self.target_dec_id {
38            write!(f, ", target_dec_id: {}", target_dec_id)?;
39        }
40
41        if let Some(target) = &self.target {
42            write!(f, ", target: {}", target)?;
43        }
44
45        write!(f, ", flags: {}", self.flags)?;
46
47        Ok(())
48    }
49}
50
51#[derive(Clone, Debug, Serialize, Deserialize)]
52pub struct GlobalStateMetaAddAccessOutputRequest {
53    pub common: MetaOutputRequestCommon,
54
55    pub item: GlobalStatePathAccessItem,
56}
57
58#[derive(Clone, Debug, Serialize, Deserialize)]
59pub struct GlobalStateMetaAddAccessOutputResponse {
60    pub updated: bool,
61}
62
63pub type GlobalStateMetaRemoveAccessOutputRequest = GlobalStateMetaAddAccessOutputRequest;
64
65#[derive(Clone, Debug, Serialize, Deserialize)]
66pub struct GlobalStateMetaRemoveAccessOutputResponse {
67    pub item: Option<GlobalStatePathAccessItem>,
68}
69
70#[derive(Clone, Debug, Serialize, Deserialize)]
71pub struct GlobalStateMetaClearAccessOutputRequest {
72    pub common: MetaOutputRequestCommon,
73}
74
75#[derive(Clone, Debug, Serialize, Deserialize)]
76pub struct GlobalStateMetaClearAccessOutputResponse {
77    pub count: u32,
78}
79
80#[derive(Clone, Debug, Serialize, Deserialize)]
81pub struct GlobalStateMetaAddLinkOutputRequest {
82    pub common: MetaOutputRequestCommon,
83
84    pub source: String,
85    pub target: String,
86}
87
88#[derive(Clone, Debug, Serialize, Deserialize)]
89pub struct GlobalStateMetaAddLinkOutputResponse {
90    pub updated: bool,
91}
92
93#[derive(Clone, Debug, Serialize, Deserialize)]
94pub struct GlobalStateMetaRemoveLinkOutputRequest {
95    pub common: MetaOutputRequestCommon,
96
97    pub source: String,
98}
99
100#[derive(Clone, Debug, Serialize, Deserialize)]
101pub struct GlobalStateMetaRemoveLinkOutputResponse {
102    pub item: Option<GlobalStatePathLinkItem>,
103}
104
105#[derive(Clone, Debug, Serialize, Deserialize)]
106pub struct GlobalStateMetaClearLinkOutputRequest {
107    pub common: MetaOutputRequestCommon,
108}
109
110#[derive(Clone, Debug, Serialize, Deserialize)]
111pub struct GlobalStateMetaClearLinkOutputResponse {
112    pub count: u32,
113}
114
115
116#[derive(Clone, Debug, Serialize, Deserialize)]
117pub struct GlobalStateMetaAddObjectMetaOutputRequest {
118    pub common: MetaOutputRequestCommon,
119
120    pub item: GlobalStateObjectMetaItem,
121}
122
123#[derive(Clone, Debug, Serialize, Deserialize)]
124pub struct GlobalStateMetaAddObjectMetaOutputResponse {
125    pub updated: bool,
126}
127
128pub type GlobalStateMetaRemoveObjectMetaOutputRequest = GlobalStateMetaAddObjectMetaOutputRequest;
129
130#[derive(Clone, Debug, Serialize, Deserialize)]
131pub struct GlobalStateMetaRemoveObjectMetaOutputResponse {
132    pub item: Option<GlobalStateObjectMetaItem>,
133}
134
135
136#[derive(Clone, Debug, Serialize, Deserialize)]
137pub struct GlobalStateMetaClearObjectMetaOutputRequest {
138    pub common: MetaOutputRequestCommon,
139}
140
141#[derive(Clone, Debug, Serialize, Deserialize)]
142pub struct GlobalStateMetaClearObjectMetaOutputResponse {
143    pub count: u32,
144}
145
146// path config
147#[derive(Clone, Debug, Serialize, Deserialize)]
148pub struct GlobalStateMetaAddPathConfigOutputRequest {
149    pub common: MetaOutputRequestCommon,
150
151    pub item: GlobalStatePathConfigItem,
152}
153
154#[derive(Clone, Debug, Serialize, Deserialize)]
155pub struct GlobalStateMetaAddPathConfigOutputResponse {
156    pub updated: bool,
157}
158
159pub type GlobalStateMetaRemovePathConfigOutputRequest = GlobalStateMetaAddPathConfigOutputRequest;
160
161#[derive(Clone, Debug, Serialize, Deserialize)]
162pub struct GlobalStateMetaRemovePathConfigOutputResponse {
163    pub item: Option<GlobalStatePathConfigItem>,
164}
165
166
167#[derive(Clone, Debug, Serialize, Deserialize)]
168pub struct GlobalStateMetaClearPathConfigOutputRequest {
169    pub common: MetaOutputRequestCommon,
170}
171
172#[derive(Clone, Debug, Serialize, Deserialize)]
173pub struct GlobalStateMetaClearPathConfigOutputResponse {
174    pub count: u32,
175}