Clio develop
The XRP Ledger API server.
|
Represents a handle to the cassandra database cluster. More...
#include <Handle.hpp>
Public Types | |
using | ResultOrErrorType = ResultOrError |
using | MaybeErrorType = MaybeError |
using | FutureWithCallbackType = FutureWithCallback |
using | FutureType = Future |
using | StatementType = Statement |
using | PreparedStatementType = PreparedStatement |
using | ResultType = Result |
Public Member Functions | |
Handle (Settings clusterSettings=Settings::defaultSettings()) | |
Construct a new handle from a Settings object. | |
Handle (std::string_view contactPoints) | |
Construct a new handle with default settings and only by setting the contact points. | |
~Handle () | |
Disconnects gracefully if possible. | |
Handle (Handle &&)=default | |
Move is supported. | |
FutureType | asyncConnect () const |
Connect to the cluster asynchronously. | |
MaybeErrorType | connect () const |
Synchonous version of the above. | |
FutureType | asyncConnect (std::string_view keyspace) const |
Connect to the the specified keyspace asynchronously. | |
MaybeErrorType | connect (std::string_view keyspace) const |
Synchonous version of the above. | |
FutureType | asyncDisconnect () const |
Disconnect from the cluster asynchronously. | |
MaybeErrorType | disconnect () const |
Synchonous version of the above. | |
FutureType | asyncReconnect (std::string_view keyspace) const |
Reconnect to the the specified keyspace asynchronously. | |
MaybeErrorType | reconnect (std::string_view keyspace) const |
Synchonous version of the above. | |
template<typename... Args> | |
FutureType | asyncExecute (std::string_view query, Args &&... args) const |
Execute a simple query with optional args asynchronously. | |
template<typename... Args> | |
ResultOrErrorType | execute (std::string_view query, Args &&... args) const |
Synchonous version of the above. | |
std::vector< FutureType > | asyncExecuteEach (std::vector< StatementType > const &statements) const |
Execute each of the statements asynchronously. | |
MaybeErrorType | executeEach (std::vector< StatementType > const &statements) const |
Synchonous version of the above. | |
template<typename... Args> | |
FutureType | asyncExecute (PreparedStatementType const &statement, Args &&... args) const |
Execute a prepared statement with optional args asynchronously. | |
template<typename... Args> | |
ResultOrErrorType | execute (PreparedStatementType const &statement, Args &&... args) const |
Synchonous version of the above. | |
FutureType | asyncExecute (StatementType const &statement) const |
Execute one (bound or simple) statements asynchronously. | |
FutureWithCallbackType | asyncExecute (StatementType const &statement, std::function< void(ResultOrErrorType)> &&cb) const |
Execute one (bound or simple) statements asynchronously with a callback. | |
ResultOrErrorType | execute (StatementType const &statement) const |
Synchonous version of the above. | |
FutureType | asyncExecute (std::vector< StatementType > const &statements) const |
Execute a batch of (bound or simple) statements asynchronously. | |
MaybeErrorType | execute (std::vector< StatementType > const &statements) const |
Synchonous version of the above. | |
FutureWithCallbackType | asyncExecute (std::vector< StatementType > const &statements, std::function< void(ResultOrErrorType)> &&cb) const |
Execute a batch of (bound or simple) statements asynchronously with a completion callback. | |
PreparedStatementType | prepare (std::string_view query) const |
Prepare a statement. | |
Represents a handle to the cassandra database cluster.
|
explicit |
Construct a new handle from a Settings object.
clusterSettings | The settings to use |
|
explicit |
Construct a new handle with default settings and only by setting the contact points.
contactPoints | The contact points to use instead of settings |
|
nodiscard |
Connect to the cluster asynchronously.
|
nodiscard |
Connect to the the specified keyspace asynchronously.
keyspace | The keyspace to use |
|
nodiscard |
Disconnect from the cluster asynchronously.
|
inlinenodiscard |
Execute a prepared statement with optional args asynchronously.
statement | The prepared statement to execute |
args | The arguments to bind for execution |
|
nodiscard |
Execute one (bound or simple) statements asynchronously.
statement | The statement to execute |
|
nodiscard |
Execute one (bound or simple) statements asynchronously with a callback.
statement | The statement to execute |
cb | The callback to execute when data is ready |
|
inlinenodiscard |
Execute a simple query with optional args asynchronously.
query | The query to execute |
args | The arguments to bind for execution |
|
nodiscard |
Execute a batch of (bound or simple) statements asynchronously.
statements | The statements to execute |
|
nodiscard |
Execute a batch of (bound or simple) statements asynchronously with a completion callback.
statements | The statements to execute |
cb | The callback to execute when data is ready |
|
nodiscard |
Execute each of the statements asynchronously.
Batched version is not always the right option. Especially since it only supports INSERT, UPDATE and DELETE statements. This can be used as an alternative when statements need to execute in bulk.
statements | The statements to execute |
|
nodiscard |
Reconnect to the the specified keyspace asynchronously.
keyspace | The keyspace to use |
|
nodiscard |
Synchonous version of the above.
See asyncConnect() const for how this works.
|
nodiscard |
Synchonous version of the above.
See asyncConnect(std::string_view) const for how this works.
keyspace | The keyspace to use |
Handle::MaybeErrorType data::cassandra::Handle::disconnect | ( | ) | const |
Synchonous version of the above.
See asyncDisconnect() const for how this works.
|
inline |
Synchonous version of the above.
See asyncExecute(std::vector<StatementType> const&, Args&&...) const for how this works.
statement | The prepared statement to bind and execute |
args | The arguments to bind for execution |
Handle::ResultOrErrorType data::cassandra::Handle::execute | ( | StatementType const & | statement | ) | const |
Synchonous version of the above.
See asyncExecute(StatementType const&) const for how this works.
statement | The statement to execute |
|
inline |
Synchonous version of the above.
See asyncExecute(std::string_view, Args&&...) const for how this works.
query | The query to execute |
args | The arguments to bind for execution |
Handle::MaybeErrorType data::cassandra::Handle::execute | ( | std::vector< StatementType > const & | statements | ) | const |
Synchonous version of the above.
See asyncExecute(std::vector<StatementType> const&) const for how this works.
statements | The statements to execute |
Handle::MaybeErrorType data::cassandra::Handle::executeEach | ( | std::vector< StatementType > const & | statements | ) | const |
Synchonous version of the above.
See asyncExecuteEach(std::vector<StatementType> const&) const for how this works.
statements | The statements to execute |
|
nodiscard |
Prepare a statement.
query |
std::runtime_error | with underlying error description on failure |
|
nodiscard |
Synchonous version of the above.
See asyncReconnect(std::string_view) const for how this works.
keyspace | The keyspace to use |