@@ -122,44 +122,6 @@ static fdb5::FDBToolRequest make_tool_request(const std::string& request_str) {
122122 return fdb5::FDBToolRequest{mars, all, std::vector<std::string>{}};
123123}
124124
125- // / Convert ControlIdentifier enum to string
126- static std::string control_identifier_to_string (fdb5::ControlIdentifier id) {
127- switch (id) {
128- case fdb5::ControlIdentifier::List:
129- return " list" ;
130- case fdb5::ControlIdentifier::Retrieve:
131- return " retrieve" ;
132- case fdb5::ControlIdentifier::Archive:
133- return " archive" ;
134- case fdb5::ControlIdentifier::Wipe:
135- return " wipe" ;
136- case fdb5::ControlIdentifier::UniqueRoot:
137- return " uniqueRoot" ;
138- default :
139- return " unknown" ;
140- }
141- }
142-
143- // / Convert string to ControlIdentifier enum
144- static fdb5::ControlIdentifier control_identifier_from_string (const std::string& s) {
145- if (s == " list" ) {
146- return fdb5::ControlIdentifier::List;
147- }
148- if (s == " retrieve" ) {
149- return fdb5::ControlIdentifier::Retrieve;
150- }
151- if (s == " archive" ) {
152- return fdb5::ControlIdentifier::Archive;
153- }
154- if (s == " wipe" ) {
155- return fdb5::ControlIdentifier::Wipe;
156- }
157- if (s == " uniqueRoot" ) {
158- return fdb5::ControlIdentifier::UniqueRoot;
159- }
160- return fdb5::ControlIdentifier::None;
161- }
162-
163125// ============================================================================
164126// FdbHandle implementation
165127// ============================================================================
@@ -200,10 +162,8 @@ FdbStatsData FdbHandle::stats() const {
200162 return data;
201163}
202164
203- bool FdbHandle::enabled (rust::Str identifier) const {
204- std::string id_str{identifier};
205- auto ctrl_id = control_identifier_from_string (id_str);
206- return impl_.enabled (ctrl_id);
165+ bool FdbHandle::enabled (fdb5::ControlIdentifier identifier) const {
166+ return impl_.enabled (identifier);
207167}
208168
209169rust::String FdbHandle::id () const {
@@ -607,7 +567,7 @@ ControlElementData ControlIteratorHandle::next() {
607567 ControlElementData data;
608568 data.location = rust::String (current_.location .asString ());
609569 for (const auto & id : current_.controlIdentifiers ) {
610- data.identifiers .push_back (rust::String ( control_identifier_to_string (id)) );
570+ data.identifiers .push_back (id );
611571 }
612572 return data;
613573}
@@ -889,14 +849,13 @@ std::unique_ptr<StatsIteratorHandle> stats_iterator(FdbHandle& handle, rust::Str
889849// ============================================================================
890850
891851std::unique_ptr<ControlIteratorHandle> control (FdbHandle& handle, rust::Str request, fdb5::ControlAction action,
892- const rust::Vec<rust::String>& identifiers) {
852+ rust::Slice< const fdb5::ControlIdentifier> identifiers) {
893853 std::string request_str{request};
894854 auto tool_request = make_tool_request (request_str);
895855
896- // Parse control identifiers using |= operator
897856 fdb5::ControlIdentifiers ctrl_ids;
898- for (const auto & id : identifiers) {
899- ctrl_ids |= control_identifier_from_string ( std::string (id)) ;
857+ for (auto id : identifiers) {
858+ ctrl_ids |= id ;
900859 }
901860
902861 auto it = handle.inner ().control (tool_request, action, ctrl_ids);
0 commit comments