linkahead/transaction_status.h
Defines
-
LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(_StatusName, _StatusCode)
Define static factory method in the TransactionStatus class.
-
namespace linkahead
-
namespace transaction
Creation and execution of transactions.
- Author
Timm Fitschen
- Date
2021-08-05
-
class TransactionStatus
- #include <transaction_status.h>
TransactionStatus indicates the current status of a transaction and, when it has already terminated, whether the transaction has been successful or not.
A status code of 0 denotes a generic success state, positive values indicate errors, and negative values indicate other states, such as different stages of a transaction in process.
Public Functions
- LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(AUTHENTICATION_ERROR, StatusCode::AUTHENTICATION_ERROR) inline static auto AUTHENTICATION_ERROR(const std LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY (FILE_DOWNLOAD_ERROR, StatusCode::FILE_DOWNLOAD_ERROR)
Factory for an INITIAL status.
This status means that the transaction has not been executed yet and the transaction does not contain any sub-transactions yet. Factory for a GO_ON status.
This status means that the transaction has not been executed yet but it already contains sub-transaction and more subtransactions may be added.
However, it also can be executed right now. Factory for a READY status.
This status means that the transaction has not been executed yet but it is ready to be executed and it is not possible anymore to add further sub-transactions. Factory for an EXECUTING status.
This status means that the transaction is currently being executed. Factory for a SUCCESS status.
This status means that the transaction has been executed successfully. Factory for a CANCELLED status.
This status means that the transaction has been canceled and should not be used anymore. Factory for a CONNECTION_ERROR status.
This status means that the connection could not be established. This is possibly due to misconfiguration of the client, errors in the network or because the server is down. Factory for an AUTHENTICATION_ERROR status.
This status means that the RPC layer reported an authentication error. Another factory for an TRANSACTION_ERROR Status with a detailed description. Factory for a FILE_UPLOAD_ERROR status.
This status means that the transaction failed during the upload of the file blobs of file entities. Factory for a FILE_DOWN_ERROR status.
This status means that the transaction failed during the download of the file blobs of file entities.
- LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY (TRANSACTION_ERROR, StatusCode::GENERIC_TRANSACTION_ERROR) LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(SPOILED
Factory for a TRANSACTION_ERROR status.
This status means that the transaction failed due to errors thrown by the server. Factory for a SPOILED status.
This status means that the transaction’s result set has been released and GetResultSet() will not return the actual results of the transaction anymore.
-
inline auto ThrowExceptionIfError() const -> void
-
inline auto IsTerminated() const -> bool
Return true if this TransactionStatus represents a terminated state.
-
inline auto IsError() const -> bool
Return true if this TransactionStatus represents an erroneous state.
-
inline auto GetDescription() const -> const std::string&
Return a description of the erroneous state.
No description yields an empty string.
-
inline auto GetCode() const -> StatusCode
Return the status code of the state.
-
inline TransactionStatus(StatusCode code, const std::string &description)
Public Static Functions
-
static inline auto TRANSACTION_ERROR(const std::string &details) -> const TransactionStatus
Another factory for a TRANSACTION_ERROR status with a detailed description.
-
static inline auto RPC_ERROR(const std::string &details) -> const TransactionStatus
Factory for a RPC_ERROR with a detailed description.
This status is used for any error on the RPC layer.
-
static inline auto GENERIC_ERROR(const std::string &details)
Factory for a GENERIC_ERROR status.
This status means that the transaction failed due to errors which supposedly do not have a special handling.
-
static inline auto ThrowExceptionIfError(StatusCode code, const std::string &description) -> void
-
static inline auto IsError(StatusCode code) -> bool
Return true if the given StatusCode represents an erroneous state.
Private Members
-
StatusCode code
The code is an identifier of errors.
-
std::string description
Description of the error
-
namespace transaction