OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
async_interface.hpp
Go to the documentation of this file.
1// Copyright (c) 2021 MIT Digital Currency Initiative,
2// Federal Reserve Bank of Boston
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef OPENCBDC_TX_SRC_SENTINEL_2PC_INTERFACE_H_
7#define OPENCBDC_TX_SRC_SENTINEL_2PC_INTERFACE_H_
8
11#include "util/common/hash.hpp"
12
13#include <optional>
14#include <string>
15
16namespace cbdc::sentinel {
19 public:
20 virtual ~async_interface() = default;
21
22 async_interface() = default;
24 auto operator=(const async_interface&) -> async_interface& = delete;
27
30 = std::function<void(std::optional<cbdc::sentinel::response>)>;
31
33 using execute_result_callback_type = std::function<void(
34 std::optional<cbdc::sentinel::execute_response>)>;
35
42 virtual auto
44 execute_result_callback_type result_callback)
45 -> bool
46 = 0;
47
50 using validate_result
51 = std::optional<cbdc::sentinel::validate_response>;
54 = std::function<void(validate_result)>;
55
62 virtual auto
64 validate_result_callback_type result_callback)
65 -> bool
66 = 0;
67 };
68}
69
70#endif
Interface for an asynchronous sentinel.
std::optional< cbdc::sentinel::validate_response > validate_result
Result of a validation operation.
std::function< void( std::optional< cbdc::sentinel::execute_response >)> execute_result_callback_type
Callback function for transaction execution result.
std::function< void(validate_result)> validate_result_callback_type
Callback function for providing a transaction validation result.
async_interface(const async_interface &)=delete
std::function< void(std::optional< cbdc::sentinel::response >)> result_callback_type
Callback function for a sentinel response.
async_interface(async_interface &&)=delete
auto operator=(async_interface &&) -> async_interface &=delete
virtual auto validate_transaction(transaction::full_tx tx, validate_result_callback_type result_callback) -> bool=0
Statically validate the given transaction and generate a sentinel attestation if the transaction is v...
virtual auto execute_transaction(transaction::full_tx tx, execute_result_callback_type result_callback) -> bool=0
Validate transaction on the sentinel, forward it to the coordinator network, and return the execution...
virtual ~async_interface()=default
auto operator=(const async_interface &) -> async_interface &=delete
A complete transaction.