• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <functional>
20 #include <mutex>
21 #include <string>
22 #include <unordered_map>
23 #include <vector>
24 
25 #include <fruit/fruit.h>
26 
27 #include "common/libs/utils/result.h"
28 #include "host/commands/cvd/server_command/flags_collector.h"
29 #include "host/commands/cvd/server_command/host_tool_target.h"
30 #include "host/commands/cvd/server_command/operation_to_bins_map.h"
31 
32 namespace cuttlefish {
33 
34 struct HostToolFlagRequestForm {
35   std::string artifacts_path;
36   // operations like stop, start, status, etc
37   std::string op;
38   std::string flag_name;
39 };
40 
41 struct HostToolExecNameRequestForm {
42   std::string artifacts_path;
43   // operations like stop, start, status, etc
44   std::string op;
45 };
46 
47 class HostToolTargetManager {
48  public:
49   virtual ~HostToolTargetManager() = default;
50   virtual Result<FlagInfo> ReadFlag(const HostToolFlagRequestForm& request) = 0;
51   virtual Result<std::string> ExecBaseName(
52       const HostToolExecNameRequestForm& request) = 0;
53 };
54 
55 fruit::Component<fruit::Required<OperationToBinsMap>, HostToolTargetManager>
56 HostToolTargetManagerComponent();
57 
58 }  // namespace cuttlefish
59