userver
C++ Async Framework
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
Toggle main menu visibility
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
bulk_ops.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/mongo/bulk_ops.hpp
4
/// @brief Bulk sub-operation models
5
6
#
include
<
userver
/
compiler
/
select
.
hpp
>
7
#
include
<
userver
/
formats
/
bson
/
document
.
hpp
>
8
#
include
<
userver
/
storages
/
mongo
/
options
.
hpp
>
9
#
include
<
userver
/
utils
/
fast_pimpl
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
storages::mongo::
operations
{
14
class
Bulk
;
15
}
// namespace storages::mongo::operations
16
17
/// Bulk sub-operations
18
namespace
storages::mongo::
bulk_ops
{
19
20
/// Inserts a single document as part of bulk operation
21
class
InsertOne
{
22
public
:
23
explicit
InsertOne(
formats
::
bson
::
Document
document);
24
~InsertOne();
25
26
InsertOne(
const
InsertOne
&);
27
InsertOne(
InsertOne
&&)
noexcept
;
28
InsertOne
& operator=(
const
InsertOne
&);
29
InsertOne
& operator=(
InsertOne
&&)
noexcept
;
30
31
void
SetOption()
const
{}
32
33
private
:
34
friend
class
storages::mongo::
operations
::
Bulk
;
35
36
class
Impl;
37
static
constexpr
std::size_t kSize =
compiler
::SelectSize()
//
38
.For64Bit(16)
39
.For32Bit(8);
40
static
constexpr
size_t kAlignment =
alignof
(
void
*);
41
utils
::FastPimpl<Impl, kSize, kAlignment,
utils
::
kStrictMatch
> impl_;
42
};
21
class
InsertOne
{
…
};
43
44
/// Replaces a single document as part of bulk operation
45
class
ReplaceOne
{
46
public
:
47
ReplaceOne(
formats
::
bson
::
Document
selector,
formats
::
bson
::
Document
replacement);
48
~ReplaceOne();
49
50
ReplaceOne(
const
ReplaceOne
&);
51
ReplaceOne(
ReplaceOne
&&)
noexcept
;
52
ReplaceOne
& operator=(
const
ReplaceOne
&);
53
ReplaceOne
& operator=(
ReplaceOne
&&)
noexcept
;
54
55
void
SetOption(
options
::
Upsert
);
56
57
private
:
58
friend
class
storages::mongo::
operations
::
Bulk
;
59
60
class
Impl;
61
static
constexpr
std::size_t kSize =
compiler
::SelectSize()
//
62
.For64Bit(48)
63
.For32Bit(24);
64
static
constexpr
size_t kAlignment =
alignof
(
void
*);
65
utils
::FastPimpl<Impl, kSize, kAlignment,
utils
::
kStrictMatch
> impl_;
66
};
45
class
ReplaceOne
{
…
};
67
68
/// Updates documents as part of bulk operation
69
class
Update
{
70
public
:
71
enum
class
Mode { kSingle, kMulti };
72
73
Update(Mode mode,
formats
::
bson
::
Document
selector,
formats
::
bson
::
Document
update);
74
~Update();
75
76
Update(
const
Update
&);
77
Update(
Update
&&)
noexcept
;
78
Update
& operator=(
const
Update
&);
79
Update
& operator=(
Update
&&)
noexcept
;
80
81
void
SetOption(
options
::
Upsert
);
82
void
SetOption(
const
options
::
ArrayFilters
&);
83
84
private
:
85
friend
class
storages::mongo::
operations
::
Bulk
;
86
87
class
Impl;
88
static
constexpr
std::size_t kSize =
compiler
::SelectSize()
//
89
.For64Bit(56)
90
.For32Bit(28);
91
static
constexpr
size_t kAlignment =
alignof
(
void
*);
92
utils
::FastPimpl<Impl, kSize, kAlignment,
utils
::
kStrictMatch
> impl_;
93
};
69
class
Update
{
…
};
94
95
/// Deletes documents as part of bulk operation
96
class
Delete
{
97
public
:
98
enum
class
Mode { kSingle, kMulti };
99
100
Delete(Mode mode,
formats
::
bson
::
Document
selector);
101
~Delete();
102
103
Delete(
const
Delete
&);
104
Delete(
Delete
&&)
noexcept
;
105
Delete
& operator=(
const
Delete
&);
106
Delete
& operator=(
Delete
&&)
noexcept
;
107
108
void
SetOption()
const
{}
109
110
private
:
111
friend
class
storages::mongo::
operations
::
Bulk
;
112
113
class
Impl;
114
static
constexpr
std::size_t kSize =
compiler
::SelectSize()
//
115
.For64Bit(24)
116
.For32Bit(12);
117
static
constexpr
size_t kAlignment =
alignof
(
void
*);
118
utils
::FastPimpl<Impl, kSize, kAlignment,
utils
::
kStrictMatch
> impl_;
119
};
96
class
Delete
{
…
};
120
121
}
// namespace storages::mongo::bulk_ops
18
namespace
storages::mongo::
bulk_ops
{
…
}
122
123
USERVER_NAMESPACE_END
Docs version:
v1.0
,
v2.0
,
trunk/develop
userver
storages
mongo
bulk_ops.hpp
Generated on Wed Apr 30 2025 15:56:57 for userver by
Doxygen
1.13.2