Android-cuttlefish cvd tool
create.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 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 <optional>
20#include <string>
21#include <unordered_map>
22#include <vector>
23
34
35namespace cuttlefish {
36
38 public:
40
41 Result<void> Handle(const CommandRequest& request) override;
42 std::vector<std::string> CmdList() const override { return {"create"}; }
43 std::string SummaryHelp() const override;
45 bool RequiresHostConfiguration() const override { return true; }
46
47 private:
48 struct CreateFlags {
49 std::string host_path;
50 std::string product_path;
51 bool start;
52 std::string config_file;
53 bool reuse;
54 };
55
58 std::optional<Fd> in_progress_lock;
59 };
60
61 std::vector<Flag> ConfigFileModeFlags();
62 std::vector<Flag> FlagModeFlags(
63 const std::unordered_map<std::string, std::string>& env,
66 const std::string& group_name,
67 const std::optional<std::string>& target_custom_home,
68 const std::string& target_host,
69 const std::vector<std::string>& target_products,
70 const std::optional<std::vector<std::string>>& requested_names);
72 const selector::SelectorOptions& selectors,
73 const selector::GroupCreationInfo& creation_info);
75
79};
80
81} // namespace cuttlefish
Definition: command_request.h:34
Definition: command_handler.h:28
std::vector< Flag > ConfigFileModeFlags()
Definition: create.cpp:707
Result< std::string > DetailedHelp(const CommandRequest &) override
Definition: create.cpp:641
bool RequiresHostConfiguration() const override
Definition: create.h:45
selector::NumInstancesParser num_instances_parser_
Definition: create.h:78
InstanceManager & instance_manager_
Definition: create.h:76
Result< std::optional< GroupWithLock > > FindReusableGroupByName(const std::string &group_name, const std::optional< std::string > &target_custom_home, const std::string &target_host, const std::vector< std::string > &target_products, const std::optional< std::vector< std::string > > &requested_names)
Definition: create.cpp:404
std::string SummaryHelp() const override
Definition: create.cpp:637
std::vector< std::string > CmdList() const override
Definition: create.h:42
Result< void > Handle(const CommandRequest &request) override
Definition: create.cpp:538
std::vector< Flag > FlagModeFlags(const std::unordered_map< std::string, std::string > &env, const selector::SelectorOptions &)
Definition: create.cpp:713
Result< std::optional< GroupWithLock > > FindReusableGroup(const selector::SelectorOptions &selectors, const selector::GroupCreationInfo &creation_info)
Definition: create.cpp:441
Result< GroupWithLock > CreateGroup(selector::GroupCreationInfo creation_info)
Definition: create.cpp:622
CvdCreateCommandHandler(InstanceManager &instance_manager)
Definition: create.cpp:399
CreateFlags own_flags_
Definition: create.h:77
Definition: instance_manager.h:51
Definition: local_instance_group.h:32
Definition: num_instances_parser.h:32
Definition: alloc_driver.h:21
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30
std::string config_file
Definition: create.h:52
std::string product_path
Definition: create.h:50
std::string host_path
Definition: create.h:49
LocalInstanceGroup group
Definition: create.h:57
std::optional< Fd > in_progress_lock
Definition: create.h:58
Definition: creation_analyzer.h:31
Definition: selector_common_parser.h:28