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
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;