userver: storages::mongo::options::WriteConcern Class Reference
Loading...
Searching...
No Matches
storages::mongo::options::WriteConcern Class Reference

#include <userver/storages/mongo/options.hpp>

Detailed Description

Write concern.

See also
https://docs.mongodb.org/manual/reference/write-concern/

Definition at line 79 of file options.hpp.

Public Types

enum  Level {
  kMajority ,
  kUnacknowledged
}
 

Public Member Functions

 WriteConcern (Level level)
 Creates a write concern with the special level.
 
 WriteConcern (size_t nodes_count)
 Creates a write concern waiting for propagation to nodes_count RS nodes.
 
 WriteConcern (std::string tag)
 Creates a write concern defined in RS config.
 
bool IsMajority () const
 
size_t NodesCount () const
 
const std::string & Tag () const
 
std::optional< bool > Journal () const
 
const std::chrono::milliseconds & Timeout () const
 
WriteConcernSetTimeout (std::chrono::milliseconds timeout)
 Sets write concern timeout, 0 means no timeout.
 
WriteConcernSetJournal (bool value)
 Sets whether to wait for on-disk journal commit.
 

Static Public Attributes

static constexpr std::chrono::seconds kDefaultMajorityTimeout {1}
 Default timeout for "majority" write concern.
 

Member Enumeration Documentation

◆ Level

Enumerator
kMajority 

Wait until propagation to a "majority" of RS nodes.

kUnacknowledged 

Do not check for operation errors, do not wait for write, same as 0

Definition at line 81 of file options.hpp.

Member Data Documentation

◆ kDefaultMajorityTimeout

constexpr std::chrono::seconds storages::mongo::options::WriteConcern::kDefaultMajorityTimeout {1}
staticconstexpr

Default timeout for "majority" write concern.

Definition at line 89 of file options.hpp.


The documentation for this class was generated from the following file: