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
use super::*;
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct Pong {
pub running: bool
}
pub trait SdaService :
Send
+ Sync
+ SdaBaseService
+ SdaAgentService
+ SdaAggregationService
+ SdaClerkingService
+ SdaParticipationService
+ SdaRecipientService
{}
pub trait SdaBaseService : Sync + Send {
fn ping(&self) -> SdaResult<Pong>;
}
pub trait SdaAgentService : SdaBaseService {
fn create_agent(&self, caller: &Agent, agent: &Agent) -> SdaResult<()>;
fn get_agent(&self, caller: &Agent, agent: &AgentId) -> SdaResult<Option<Agent>>;
fn upsert_profile(&self, caller: &Agent, profile: &Profile) -> SdaResult<()>;
fn get_profile(&self, caller: &Agent, owner: &AgentId) -> SdaResult<Option<Profile>>;
fn create_encryption_key(&self, caller: &Agent, key: &SignedEncryptionKey) -> SdaResult<()>;
fn get_encryption_key(&self, caller: &Agent, key: &EncryptionKeyId) -> SdaResult<Option<SignedEncryptionKey>>;
}
pub trait SdaAggregationService : SdaBaseService {
fn list_aggregations(&self, caller: &Agent, filter: Option<&str>, recipient: Option<&AgentId>) -> SdaResult<Vec<AggregationId>>;
fn get_aggregation(&self, caller: &Agent, aggregation: &AggregationId) -> SdaResult<Option<Aggregation>>;
fn get_committee(&self, caller: &Agent, owner: &AggregationId) -> SdaResult<Option<Committee>>;
}
pub trait SdaParticipationService : SdaBaseService {
fn create_participation(&self, caller: &Agent, participation: &Participation) -> SdaResult<()>;
}
pub trait SdaClerkingService : SdaBaseService {
fn get_clerking_job(&self, caller: &Agent, clerk: &AgentId) -> SdaResult<Option<ClerkingJob>>;
fn create_clerking_result(&self, caller: &Agent, result: &ClerkingResult) -> SdaResult<()>;
}
pub trait SdaRecipientService : SdaBaseService {
fn create_aggregation(&self, caller: &Agent, aggregation: &Aggregation) -> SdaResult<()>;
fn delete_aggregation(&self, caller: &Agent, aggregation: &AggregationId) -> SdaResult<()>;
fn suggest_committee(&self, caller: &Agent, aggregation: &AggregationId) -> SdaResult<Vec<ClerkCandidate>>;
fn create_committee(&self, caller: &Agent, committee: &Committee) -> SdaResult<()>;
fn get_aggregation_status(&self, caller: &Agent, aggregation: &AggregationId) -> SdaResult<Option<AggregationStatus>>;
fn create_snapshot(&self, caller: &Agent, snapshot: &Snapshot) -> SdaResult<()>;
fn get_snapshot_result(&self, caller: &Agent, aggregation: &AggregationId, snapshot: &SnapshotId) -> SdaResult<Option<SnapshotResult>>;
}