Android-cuttlefish cvd tool
file_monitor_source.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 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 <stddef.h>
20
21#include <functional>
22#include <memory>
23#include <string>
24
25#include "absl/strings/string_view.h"
26
31
32namespace cuttlefish {
33
35 public:
37 std::string path, std::unique_ptr<ReaderSeeker> file_io,
38 std::function<Result<std::string>(absl::string_view)> colorize_line,
39 std::function<Result<bool>(absl::string_view)> filter_line);
41
42 MonitorOutput Report(size_t rows, size_t columns) override;
43
44 SharedFD ReadyFd() override;
45
46 private:
47 std::string path_;
48 std::unique_ptr<ReaderSeeker> file_io_;
49 std::function<Result<std::string>(absl::string_view)> colorize_line_;
50 std::function<Result<bool>(absl::string_view)> filter_line_;
52};
53
54} // namespace cuttlefish
Definition: file_monitor_source.h:34
std::function< Result< std::string >(absl::string_view)> colorize_line_
Definition: file_monitor_source.h:49
std::unique_ptr< ReaderSeeker > file_io_
Definition: file_monitor_source.h:48
std::string path_
Definition: file_monitor_source.h:47
SharedFD ReadyFd() override
Definition: file_monitor_source.cc:143
FileMonitorSource(std::string path, std::unique_ptr< ReaderSeeker > file_io, std::function< Result< std::string >(absl::string_view)> colorize_line, std::function< Result< bool >(absl::string_view)> filter_line)
Definition: file_monitor_source.cc:108
MonitorOutput Report(size_t rows, size_t columns) override
Definition: file_monitor_source.cc:125
std::function< Result< bool >(absl::string_view)> filter_line_
Definition: file_monitor_source.h:50
SharedFD inotify_fd_
Definition: file_monitor_source.h:51
Definition: monitor_source.h:36
Definition: shared_fd.h:125
Definition: alloc_driver.h:21
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30
Definition: monitor_source.h:28