Android-cuttlefish cvd tool
cvdalloc.h
Go to the documentation of this file.
1//
2// Copyright (C) 2025 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#pragma once
17
18#include <mutex>
19#include <string_view>
20
21#include "fruit/fruit.h"
22
29
30namespace cuttlefish {
31
32enum class CvdallocStatus;
33
35 public:
37
38 // CommandSource
40 std::string Name() const override;
41 bool Enabled() const override;
42 std::unordered_set<SetupFeature*> Dependencies() const override;
43
44 // StatusCheckCommandSource
46
47 private:
48 Result<void> ResultSetup() override;
49 Result<void> BinaryIsValid(std::string_view path);
50 Result<void> IsUsable() const;
52
57};
58
59fruit::Component<fruit::Required<const CuttlefishConfig::InstanceSpecific>>
61
62} // namespace cuttlefish
Definition: cuttlefish_config.h:252
Definition: cvdalloc.h:34
Result< void > BinaryIsValid(std::string_view path)
Definition: cvdalloc.cpp:103
SharedFD their_socket_
Definition: cvdalloc.h:54
const CuttlefishConfig::InstanceSpecific instance_
Definition: cvdalloc.h:53
std::string Name() const override
Definition: cvdalloc.cpp:68
Result< void > WaitForAvailability() override
Definition: cvdalloc.cpp:79
std::unordered_set< SetupFeature * > Dependencies() const override
Definition: cvdalloc.cpp:77
std::mutex availability_mutex_
Definition: cvdalloc.h:55
Result< void > IsUsable() const
Definition: cvdalloc.cpp:109
bool Enabled() const override
Definition: cvdalloc.cpp:70
SharedFD socket_
Definition: cvdalloc.h:54
StopperResult Stop()
Definition: cvdalloc.cpp:114
INJECT(Cvdalloc(const CuttlefishConfig::InstanceSpecific &instance))
Result< std::vector< MonitorCommand > > Commands() override
Definition: cvdalloc.cpp:55
Result< void > ResultSetup() override
Definition: cvdalloc.cpp:94
CvdallocStatus status_
Definition: cvdalloc.h:56
Definition: shared_fd.h:124
Definition: alloc_driver.h:20
StopperResult
Definition: subprocess.h:28
fruit::Component< fruit::Required< const CuttlefishConfig::InstanceSpecific > > CvdallocComponent()
Definition: cvdalloc.cpp:131
CvdallocStatus
Definition: cvdalloc.cpp:50
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30