20 #include <mongocxx/bulk_write-fwd.hpp>
21 #include <mongocxx/client-fwd.hpp>
22 #include <mongocxx/client_session-fwd.hpp>
23 #include <mongocxx/collection-fwd.hpp>
24 #include <mongocxx/database-fwd.hpp>
25 #include <mongocxx/index_view-fwd.hpp>
26 #include <mongocxx/search_index_view-fwd.hpp>
28 #include <bsoncxx/document/view.hpp>
29 #include <bsoncxx/stdx/optional.hpp>
30 #include <mongocxx/options/client_session.hpp>
32 #include <mongocxx/config/prelude.hpp>
49 enum class transaction_state {
51 k_transaction_starting,
52 k_transaction_in_progress,
53 k_transaction_committed,
54 k_transaction_aborted,
89 bsoncxx::v_noabi::document::view
id() const noexcept;
196 friend ::mongocxx::v_noabi::bulk_write;
197 friend ::mongocxx::v_noabi::client;
198 friend ::mongocxx::v_noabi::collection;
199 friend ::mongocxx::v_noabi::database;
200 friend ::mongocxx::v_noabi::index_view;
201 friend ::mongocxx::v_noabi::search_index_view;
203 class MONGOCXX_PRIVATE impl;
208 MONGOCXX_PRIVATE impl& _get_impl();
209 MONGOCXX_PRIVATE
const impl& _get_impl()
const;
211 std::unique_ptr<impl> _impl;
217 #include <mongocxx/config/postlude.hpp>
Use a session for a sequence of operations, optionally with either causal consistency or snapshots.
Definition: client_session.hpp:47
void advance_operation_time(const bsoncxx::v_noabi::types::b_timestamp &operation_time)
Advance the session's operation time, expressed as a BSON timestamp.
bsoncxx::v_noabi::document::view cluster_time() const noexcept
Get the session's clusterTime, as a BSON document.
transaction_state get_transaction_state() const noexcept
Returns the current transaction state for this session.
void advance_cluster_time(const bsoncxx::v_noabi::document::view &cluster_time)
Advance the cluster time for a session.
client_session(client_session &&) noexcept
Move constructs a session.
bsoncxx::v_noabi::types::b_timestamp operation_time() const noexcept
Get the session's operationTime, as a BSON timestamp.
bool get_dirty() const noexcept
Returns whether or not this session is dirty.
void start_transaction(const stdx::optional< options::transaction > &transaction_opts={})
Starts a transaction on the current client session.
const options::client_session & options() const noexcept
Gets the options this session was created with.
std::function< void(client_session *)> with_transaction_cb
Helper to run a user-provided callback within a transaction.
Definition: client_session.hpp:192
void abort_transaction()
Aborts a transaction on the current client session.
std::uint32_t server_id() const noexcept
Get the server_id the session is pinned to.
void commit_transaction()
Commits a transaction on the current client session.
Class representing a client connection to MongoDB.
Definition: client.hpp:61
Class representing the optional arguments to mongocxx::v_noabi::client::start_session.
Definition: client_session.hpp:33
Class representing the optional arguments for a transaction.
Definition: transaction.hpp:38
The top-level namespace for bsoncxx library entities.
Definition: element-fwd.hpp:19
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19