userver
C++ Async Framework
Toggle main menu visibility
Documentation
API Groups
Namespaces
Reference
Class List
Class Index
File List
Macros
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
operations_file.hpp
1
#
pragma
once
2
3
#
include
<
chrono
>
4
5
#
include
<
boost
/
filesystem
/
operations
.
hpp
>
6
7
#
include
<
userver
/
fs
/
blocking
/
c_file
.
hpp
>
8
#
include
<
userver
/
utils
/
cpu_relax
.
hpp
>
9
#
include
<
userver
/
utils
/
fast_pimpl
.
hpp
>
10
11
#
include
<
userver
/
dump
/
factory
.
hpp
>
12
#
include
<
userver
/
dump
/
operations
.
hpp
>
13
14
USERVER_NAMESPACE_BEGIN
15
16
namespace
dump
{
17
18
/// A handle to a dump file. File operations block the thread.
19
class
FileWriter
final
:
public
Writer
{
20
public
:
21
/// @brief Creates a new dump file and opens it
22
/// @throws `Error` on a filesystem error
23
explicit
FileWriter
(std::string path, boost::filesystem::perms perms,
tracing
::
ScopeTime
& scope);
24
25
void
Finish
()
override
;
26
27
private
:
28
void
WriteRaw(std::string_view data)
override
;
29
30
fs::
blocking
::CFile file_;
31
std::string final_path_;
32
std::string path_;
33
boost::filesystem::perms perms_;
34
utils
::
StreamingCpuRelax
cpu_relax_;
35
};
19
class
FileWriter
final
:
public
Writer
{
…
};
36
37
/// A handle to a dump file. File operations block the thread.
38
class
FileReader
final
:
public
Reader
{
39
public
:
40
/// @brief Opens an existing dump file
41
/// @throws `Error` on a filesystem error
42
explicit
FileReader
(std::string path);
43
44
void
Finish
()
override
;
45
46
private
:
47
std::string_view ReadRaw(std::size_t max_size)
override
;
48
49
void
BackUp(std::size_t size)
override
;
50
51
fs::
blocking
::CFile file_;
52
std::string path_;
53
std::string curr_chunk_;
54
};
38
class
FileReader
final
:
public
Reader
{
…
};
55
56
class
FileOperationsFactory
final
:
public
OperationsFactory
{
57
public
:
58
explicit
FileOperationsFactory(boost::filesystem::perms perms);
59
60
std::unique_ptr<
Reader
> CreateReader(std::string full_path)
override
;
61
62
std::unique_ptr<
Writer
> CreateWriter(std::string full_path,
tracing
::
ScopeTime
& scope)
override
;
63
64
private
:
65
const
boost::filesystem::perms perms_;
66
};
56
class
FileOperationsFactory
final
:
public
OperationsFactory
{
…
};
67
68
}
// namespace dump
69
70
USERVER_NAMESPACE_END
userver
dump
operations_file.hpp
Generated on Wed Apr 30 2025 15:52:47 for userver by
Doxygen
1.13.2