userver
C++ Async Framework
Loading...
Searching...
No Matches
operations_encrypted.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/dump/operations_encrypted.hpp
4
/// @brief Encrypted dump Reader and Writer implementations
5
6
#
include
<
userver
/
utils
/
boost_filesystem_file_status
.
hpp
>
7
8
#
include
<
userver
/
dump
/
factory
.
hpp
>
9
#
include
<
userver
/
dump
/
operations
.
hpp
>
10
#
include
<
userver
/
utils
/
fast_pimpl
.
hpp
>
11
#
include
<
userver
/
utils
/
strong_typedef
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
dump
{
16
17
using
SecretKey
=
utils
::
NonLoggable
<
class
SecretKeyTag, std::string>;
18
19
class
EncryptedWriter
final
:
public
Writer
{
20
public
:
21
/// @brief Creates a new dump file and opens it
22
/// @throws `Error` on a filesystem error
23
EncryptedWriter
(
24
std::string filename,
25
const
SecretKey& secret_key,
26
boost::filesystem::perms,
27
tracing
::
ScopeTime
& scope
28
);
29
30
~EncryptedWriter()
override
;
31
32
void
Finish
()
override
;
33
34
private
:
35
void
WriteRaw(std::string_view data)
override
;
36
37
struct
Impl;
38
utils
::FastPimpl<Impl, 632, 8> impl_;
39
};
40
41
class
EncryptedReader
final
:
public
Reader
{
42
public
:
43
/// @brief Opens an existing dump file
44
/// @throws `Error` on a filesystem error
45
EncryptedReader
(std::string filename,
const
SecretKey& key);
46
47
~EncryptedReader()
override
;
48
49
void
Finish
()
override
;
50
51
private
:
52
std::string_view ReadRaw(std::size_t max_size)
override
;
53
54
void
BackUp(std::size_t size)
override
;
55
56
struct
Impl;
57
utils
::FastPimpl<Impl, 600, 8> impl_;
58
};
59
60
class
EncryptedOperationsFactory
final
:
public
OperationsFactory
{
61
public
:
62
EncryptedOperationsFactory(SecretKey&& secret_key, boost::filesystem::perms perms);
63
64
std::unique_ptr<
Reader
> CreateReader(std::string full_path)
override
;
65
66
std::unique_ptr<
Writer
> CreateWriter(std::string full_path,
tracing
::
ScopeTime
& scope)
override
;
67
68
private
:
69
const
SecretKey secret_key_;
70
const
boost::filesystem::perms perms_;
71
};
72
73
}
// namespace dump
74
75
USERVER_NAMESPACE_END
userver
dump
operations_encrypted.hpp
Generated on Thu May 21 2026 16:18:42 for userver by
Doxygen
1.13.2