@@ -7,7 +7,7 @@ use crate::license::LicensedFeature;
7
7
use crate :: types:: { ResolveEntityId , SqliteEnumExt } ;
8
8
use anyhow:: { Context as AContext , Result , anyhow, bail} ;
9
9
use protobuf:: { beegfs as pb, management as pm} ;
10
- use rusqlite:: { OptionalExtension , Transaction , TransactionBehavior , params} ;
10
+ use rusqlite:: { OptionalExtension , Row , Transaction , TransactionBehavior , named_params , params} ;
11
11
use shared:: grpc:: * ;
12
12
use shared:: impl_grpc_handler;
13
13
use shared:: run_state:: RunStateHandle ;
@@ -21,13 +21,28 @@ use std::pin::Pin;
21
21
use tonic:: transport:: { Identity , Server , ServerTlsConfig } ;
22
22
use tonic:: { Code , Request , Response , Status } ;
23
23
24
- mod buddy_group;
25
- mod license;
26
- mod misc;
27
- mod node;
28
- mod pool;
29
- mod quota;
30
- mod target;
24
+ mod common;
25
+
26
+ mod assign_pool;
27
+ mod create_buddy_group;
28
+ mod create_pool;
29
+ mod delete_buddy_group;
30
+ mod delete_node;
31
+ mod delete_pool;
32
+ mod delete_target;
33
+ mod get_buddy_groups;
34
+ mod get_license;
35
+ mod get_nodes;
36
+ mod get_pools;
37
+ mod get_quota_limits;
38
+ mod get_quota_usage;
39
+ mod get_targets;
40
+ mod mirror_root_inode;
41
+ mod set_alias;
42
+ mod set_default_quota_limits;
43
+ mod set_quota_limits;
44
+ mod set_target_state;
45
+ mod start_resync;
31
46
32
47
/// Management gRPC service implementation struct
33
48
#[ derive( Debug ) ]
@@ -44,8 +59,9 @@ impl pm::management_server::Management for ManagementService {
44
59
// Example: Implement pm::management_server::Management::set_alias using the impl_grpc_handler
45
60
// macro
46
61
impl_grpc_handler ! {
47
- // <the function to implement (as defined by the trait)> => <the actual, custom handler function to call>,
48
- set_alias => misc:: set_alias,
62
+ // the function to implement (as defined by the trait) as well as the handler to call (must
63
+ // be named the same and in a submodule named the same),
64
+ set_alias,
49
65
// <request message passed to the fn impl (as defined by the trait)> => <response message,
50
66
// returned by the fn impl (as defined by the trait)>,
51
67
pm:: SetAliasRequest => pm:: SetAliasResponse ,
@@ -54,102 +70,102 @@ impl pm::management_server::Management for ManagementService {
54
70
}
55
71
56
72
impl_grpc_handler ! {
57
- get_nodes => node :: get ,
73
+ get_nodes,
58
74
pm:: GetNodesRequest => pm:: GetNodesResponse ,
59
75
"Get nodes"
60
76
}
61
77
impl_grpc_handler ! {
62
- delete_node => node :: delete ,
78
+ delete_node,
63
79
pm:: DeleteNodeRequest => pm:: DeleteNodeResponse ,
64
80
"Delete node"
65
81
}
66
82
67
83
impl_grpc_handler ! {
68
- get_targets => target :: get ,
84
+ get_targets,
69
85
pm:: GetTargetsRequest => pm:: GetTargetsResponse ,
70
86
"Get targets"
71
87
}
72
88
impl_grpc_handler ! {
73
- delete_target => target :: delete ,
89
+ delete_target,
74
90
pm:: DeleteTargetRequest => pm:: DeleteTargetResponse ,
75
91
"Delete target"
76
92
}
77
93
impl_grpc_handler ! {
78
- set_target_state => target :: set_state ,
94
+ set_target_state,
79
95
pm:: SetTargetStateRequest => pm:: SetTargetStateResponse ,
80
96
"Set target state"
81
97
}
82
98
83
99
impl_grpc_handler ! {
84
- get_pools => pool :: get ,
100
+ get_pools,
85
101
pm:: GetPoolsRequest => pm:: GetPoolsResponse ,
86
102
"Get pools"
87
103
}
88
104
impl_grpc_handler ! {
89
- create_pool => pool :: create ,
105
+ create_pool,
90
106
pm:: CreatePoolRequest => pm:: CreatePoolResponse ,
91
107
"Create pool"
92
108
}
93
109
impl_grpc_handler ! {
94
- assign_pool => pool :: assign ,
110
+ assign_pool,
95
111
pm:: AssignPoolRequest => pm:: AssignPoolResponse ,
96
112
"Assign pool"
97
113
}
98
114
impl_grpc_handler ! {
99
- delete_pool => pool :: delete ,
115
+ delete_pool,
100
116
pm:: DeletePoolRequest => pm:: DeletePoolResponse ,
101
117
"Delete pool"
102
118
}
103
119
104
120
impl_grpc_handler ! {
105
- get_buddy_groups => buddy_group :: get ,
121
+ get_buddy_groups,
106
122
pm:: GetBuddyGroupsRequest => pm:: GetBuddyGroupsResponse ,
107
123
"Get buddy groups"
108
124
}
109
125
impl_grpc_handler ! {
110
- create_buddy_group => buddy_group :: create ,
126
+ create_buddy_group,
111
127
pm:: CreateBuddyGroupRequest => pm:: CreateBuddyGroupResponse ,
112
128
"Create buddy group"
113
129
}
114
130
impl_grpc_handler ! {
115
- delete_buddy_group => buddy_group :: delete ,
131
+ delete_buddy_group,
116
132
pm:: DeleteBuddyGroupRequest => pm:: DeleteBuddyGroupResponse ,
117
133
"Delete buddy group"
118
134
}
119
135
impl_grpc_handler ! {
120
- mirror_root_inode => buddy_group :: mirror_root_inode ,
136
+ mirror_root_inode,
121
137
pm:: MirrorRootInodeRequest => pm:: MirrorRootInodeResponse ,
122
138
"Mirror root inode"
123
139
}
124
140
impl_grpc_handler ! {
125
- start_resync => buddy_group :: start_resync ,
141
+ start_resync,
126
142
pm:: StartResyncRequest => pm:: StartResyncResponse ,
127
143
"Start resync"
128
144
}
129
145
130
146
impl_grpc_handler ! {
131
- set_default_quota_limits => quota :: set_default_quota_limits ,
147
+ set_default_quota_limits,
132
148
pm:: SetDefaultQuotaLimitsRequest => pm:: SetDefaultQuotaLimitsResponse ,
133
149
"Set default quota limits"
134
150
}
135
151
impl_grpc_handler ! {
136
- set_quota_limits => quota :: set_quota_limits ,
152
+ set_quota_limits,
137
153
pm:: SetQuotaLimitsRequest => pm:: SetQuotaLimitsResponse ,
138
154
"Set quota limits"
139
155
}
140
156
impl_grpc_handler ! {
141
- get_quota_limits => quota :: get_quota_limits ,
157
+ get_quota_limits,
142
158
pm:: GetQuotaLimitsRequest => STREAM ( GetQuotaLimitsStream , pm:: GetQuotaLimitsResponse ) ,
143
159
"Get quota limits"
144
160
}
145
161
impl_grpc_handler ! {
146
- get_quota_usage => quota :: get_quota_usage ,
162
+ get_quota_usage,
147
163
pm:: GetQuotaUsageRequest => STREAM ( GetQuotaUsageStream , pm:: GetQuotaUsageResponse ) ,
148
164
"Get quota usage"
149
165
}
150
166
151
167
impl_grpc_handler ! {
152
- get_license => license :: get ,
168
+ get_license,
153
169
pm:: GetLicenseRequest => pm:: GetLicenseResponse ,
154
170
"Get license"
155
171
}
0 commit comments