blob: f01824a02144b05e8302513f689fde91b8bd4f09 [file] [log] [blame]
Mike Frysinger3a446f22022-09-08 07:37:141// Copyright 2021 The ChromiumOS Authors
Vyshu8bf89752021-04-23 23:28:522// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef MINIOS_RECOVERY_INSTALLER_H_
6#define MINIOS_RECOVERY_INSTALLER_H_
7
Saketh Pothireddy66f7e1a2023-10-28 05:05:108#include <memory>
Vyshu8bf89752021-04-23 23:28:529
Jae Hoon Kim7c70ae42024-02-14 07:27:5710#include "minios/process_manager.h"
Vyshu8bf89752021-04-23 23:28:5211
12namespace minios {
13
Jae Hoon Kim5271edf2024-02-14 07:30:5514class RecoveryInstallerInterface {
15 public:
16 virtual ~RecoveryInstallerInterface() = default;
17
18 virtual bool RepartitionDisk() = 0;
19};
20
Vyshu8bf89752021-04-23 23:28:5221class RecoveryInstaller : public RecoveryInstallerInterface {
22 public:
Saketh Pothireddy66f7e1a2023-10-28 05:05:1023 explicit RecoveryInstaller(
24 std::shared_ptr<ProcessManagerInterface> process_manager)
Vyshu8bf89752021-04-23 23:28:5225 : repartition_completed_(false), process_manager_(process_manager) {}
Jae Hoon Kim15da0242024-02-29 20:59:2526 ~RecoveryInstaller() override = default;
Vyshu8bf89752021-04-23 23:28:5227
28 RecoveryInstaller(const RecoveryInstaller&) = delete;
29 RecoveryInstaller& operator=(const RecoveryInstaller&) = delete;
30
31 bool RepartitionDisk() override;
32
33 private:
34 // Only repartition the disk once per recovery attempt.
35 bool repartition_completed_;
36
Saketh Pothireddy66f7e1a2023-10-28 05:05:1037 std::shared_ptr<ProcessManagerInterface> process_manager_;
Vyshu8bf89752021-04-23 23:28:5238};
39
40} // namespace minios
41
42#endif // MINIOS_RECOVERY_INSTALLER_H_