userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
bulk_ops.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <
userver/compiler/select.hpp
>
7
#include <
userver/formats/bson/document.hpp
>
8
#include <
userver/formats/bson/value.hpp
>
9
#include <
userver/storages/mongo/options.hpp
>
10
#include <
userver/utils/fast_pimpl.hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
storages::mongo::operations
{
15
class
Bulk
;
16
}
// namespace storages::mongo::operations
17
19
namespace
storages::mongo::bulk_ops
{
20
22
class
InsertOne {
23
public
:
24
explicit
InsertOne(
formats::bson::Document
document);
25
~InsertOne();
26
27
InsertOne(
const
InsertOne&);
28
InsertOne(InsertOne&&)
noexcept
;
29
InsertOne& operator=(
const
InsertOne&);
30
InsertOne& operator=(InsertOne&&)
noexcept
;
31
32
void
SetOption()
const
{}
33
34
private
:
35
friend
class
storages::mongo::operations::Bulk
;
36
37
class
Impl;
38
static
constexpr
std::size_t kSize =
39
compiler::SelectSize
()
//
40
.For64Bit(16)
41
.For32Bit(8);
42
static
constexpr
size_t
kAlignment =
alignof
(
void
*);
43
utils::FastPimpl<Impl, kSize, kAlignment, utils::kStrictMatch>
impl_;
44
};
45
47
class
ReplaceOne {
48
public
:
49
ReplaceOne(
formats::bson::Document
selector,
formats::bson::Document
replacement);
50
~ReplaceOne();
51
52
ReplaceOne(
const
ReplaceOne&);
53
ReplaceOne(ReplaceOne&&)
noexcept
;
54
ReplaceOne& operator=(
const
ReplaceOne&);
55
ReplaceOne& operator=(ReplaceOne&&)
noexcept
;
56
57
void
SetOption(
options::Upsert
);
58
59
private
:
60
friend
class
storages::mongo::operations::Bulk
;
61
62
class
Impl;
63
static
constexpr
std::size_t kSize =
64
compiler::SelectSize
()
//
65
.For64Bit(48)
66
.For32Bit(24);
67
static
constexpr
size_t
kAlignment =
alignof
(
void
*);
68
utils::FastPimpl<Impl, kSize, kAlignment, utils::kStrictMatch>
impl_;
69
};
70
72
class
Update {
73
public
:
74
enum class
Mode { kSingle, kMulti };
75
76
Update(Mode mode,
formats::bson::Document
selector,
formats::bson::Document
update);
77
81
Update
(Mode mode,
formats::bson::Document
selector,
formats::bson::Value
update);
82
83
~Update();
84
85
Update(
const
Update&);
86
Update(Update&&) noexcept;
87
Update& operator=(const Update&);
88
Update& operator=(Update&&) noexcept;
89
90
void
SetOption(
options
::Upsert);
91
void
SetOption(const
options
::ArrayFilters&);
92
94
void
SetOption(const
options
::Hint&);
95
96
private:
97
friend class
storages
::
mongo
::
operations
::Bulk;
98
99
class Impl;
100
static constexpr
std
::
size_t
kSize =
101
compiler
::SelectSize()
//
102
.For64Bit(56)
103
.For32Bit(28);
104
static constexpr
size_t
kAlignment = alignof(
void
*);
105
utils
::FastPimpl<Impl, kSize, kAlignment,
utils
::kStrictMatch> impl_;
106
};
107
109
class Delete {
110
public
:
111
enum class
Mode { kSingle, kMulti };
112
113
Delete(Mode mode,
formats::bson::Document
selector);
114
~Delete();
115
116
Delete(
const
Delete&);
117
Delete(Delete&&)
noexcept
;
118
Delete& operator=(
const
Delete&);
119
Delete& operator=(Delete&&)
noexcept
;
120
122
void
SetOption
(
const
options::Hint
&);
123
124
private
:
125
friend
class
storages::mongo::operations::Bulk
;
126
127
class
Impl;
128
static
constexpr
std::size_t kSize =
129
compiler::SelectSize
()
//
130
.For64Bit(40)
131
.For32Bit(20);
132
static
constexpr
size_t
kAlignment =
alignof
(
void
*);
133
utils::FastPimpl<Impl, kSize, kAlignment, utils::kStrictMatch>
impl_;
134
};
135
136
}
// namespace storages::mongo::bulk_ops
137
138
USERVER_NAMESPACE_END
userver
storages
mongo
bulk_ops.hpp
Generated on
for userver by
Doxygen
1.17.0