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
use super::def::*;
use super::output_request::*;
use crate::base::*;
use cyfs_base::*;

#[derive(Clone, Debug)]
pub struct MetaInputRequestCommon {
    // 来源
    pub source: RequestSourceInfo,

    // 目标DEC,如果为空,则默认等价于source-dec-id
    pub target_dec_id: Option<ObjectId>,

    // 用以默认行为
    pub target: Option<ObjectId>,

    pub flags: u32,
}

impl std::fmt::Display for MetaInputRequestCommon {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.source)?;

        if let Some(target_dec_id) = &self.target_dec_id {
            write!(f, ", target_dec_id: {}", target_dec_id)?;
        }

        if let Some(target) = &self.target {
            write!(f, ", target: {}", target)?;
        }

        write!(f, ", flags: {}", self.flags)?;

        Ok(())
    }
}

#[derive(Clone, Debug)]
pub struct GlobalStateMetaAddAccessInputRequest {
    pub common: MetaInputRequestCommon,

    pub item: GlobalStatePathAccessItem,
}

pub type GlobalStateMetaAddAccessInputResponse = GlobalStateMetaAddAccessOutputResponse;

pub type GlobalStateMetaRemoveAccessInputRequest = GlobalStateMetaAddAccessInputRequest;
pub type GlobalStateMetaRemoveAccessInputResponse = GlobalStateMetaRemoveAccessOutputResponse;

#[derive(Clone, Debug)]
pub struct GlobalStateMetaClearAccessInputRequest {
    pub common: MetaInputRequestCommon,
}

pub type GlobalStateMetaClearAccessInputResponse = GlobalStateMetaClearAccessOutputResponse;

#[derive(Clone, Debug)]
pub struct GlobalStateMetaAddLinkInputRequest {
    pub common: MetaInputRequestCommon,

    pub source: String,
    pub target: String,
}

pub type GlobalStateMetaAddLinkInputResponse = GlobalStateMetaAddLinkOutputResponse;

#[derive(Clone, Debug)]
pub struct GlobalStateMetaRemoveLinkInputRequest {
    pub common: MetaInputRequestCommon,

    pub source: String,
}

pub type GlobalStateMetaRemoveLinkInputResponse = GlobalStateMetaRemoveLinkOutputResponse;

#[derive(Clone, Debug)]
pub struct GlobalStateMetaClearLinkInputRequest {
    pub common: MetaInputRequestCommon,
}

pub type GlobalStateMetaClearLinkInputResponse = GlobalStateMetaClearLinkOutputResponse;

// object meta 
#[derive(Clone, Debug)]
pub struct GlobalStateMetaAddObjectMetaInputRequest {
    pub common: MetaInputRequestCommon,

    pub item: GlobalStateObjectMetaItem,
}

pub type GlobalStateMetaAddObjectMetaInputResponse = GlobalStateMetaAddObjectMetaOutputResponse;

pub type GlobalStateMetaRemoveObjectMetaInputRequest = GlobalStateMetaAddObjectMetaInputRequest;
pub type GlobalStateMetaRemoveObjectMetaInputResponse = GlobalStateMetaRemoveObjectMetaOutputResponse;

#[derive(Clone, Debug)]
pub struct GlobalStateMetaClearObjectMetaInputRequest {
    pub common: MetaInputRequestCommon,
}

pub type GlobalStateMetaClearObjectMetaInputResponse = GlobalStateMetaClearObjectMetaOutputResponse;


// path config
#[derive(Clone, Debug)]
pub struct GlobalStateMetaAddPathConfigInputRequest {
    pub common: MetaInputRequestCommon,

    pub item: GlobalStatePathConfigItem,
}

pub type GlobalStateMetaAddPathConfigInputResponse = GlobalStateMetaAddPathConfigOutputResponse;

pub type GlobalStateMetaRemovePathConfigInputRequest = GlobalStateMetaAddPathConfigInputRequest;
pub type GlobalStateMetaRemovePathConfigInputResponse = GlobalStateMetaRemovePathConfigOutputResponse;

#[derive(Clone, Debug)]
pub struct GlobalStateMetaClearPathConfigInputRequest {
    pub common: MetaInputRequestCommon,
}

pub type GlobalStateMetaClearPathConfigInputResponse = GlobalStateMetaClearPathConfigOutputResponse;