16 -> nuraft::ptr<nuraft::buffer> {
18 if(!maybe_req.has_value()) {
25 auto&& req = maybe_req.value();
26 auto resp = process_request(req);
29 nuraft::ptr<nuraft::buffer>>(resp);
31 m_last_committed_idx = log_idx;
45 return m_last_committed_idx;
50 nuraft::async_result<bool>::handler_type& when_done) {
51 nuraft::ptr<std::exception> except(
nullptr);
53 when_done(ret, except);
59 [[maybe_unused]]
auto success = std::visit(
62 return m_shard->prepare(
70 [&](rpc::commit_request msg) {
71 return m_shard->commit(
77 [&](rpc::finish_request msg) {
78 return m_shard->finish(
84 [&](rpc::replicated_get_tickets_request ) {
85 return m_shard->get_tickets(
std::variant< tickets_type, error_code > get_tickets_return_type
Return type from a get tickets operation.
std::optional< error_code > return_type
Return type from a prepare operation. An error, if applicable.
Implementation of the replicated shard interface.
auto apply_snapshot(nuraft::snapshot &) -> bool override
Not implemented for runtime locking shard.
auto last_snapshot() -> nuraft::ptr< nuraft::snapshot > override
Not implemented for runtime locking shard.
void create_snapshot(nuraft::snapshot &, nuraft::async_result< bool >::handler_type &) override
Not implemented for runtime locking shard.
auto get_shard() const -> std::shared_ptr< replicated_shard >
Returns the replicated shard implementation managed by the state machine.
auto last_commit_index() -> uint64_t override
Returns the most recently committed log entry index.
auto commit(uint64_t log_idx, nuraft::buffer &data) -> nuraft::ptr< nuraft::buffer > override
Commit the given raft log entry at the given log index, and return the result.
std::variant< replicated_prepare_request, commit_request, finish_request, replicated_get_tickets_request > replicated_request
Shard replicated state machine request type.
std::variant< replicated_shard_interface::return_type, replicated_shard_interface::get_tickets_return_type > replicated_response
Shard replicated state machine response type.
auto from_buffer(nuraft::buffer &buf) -> std::optional< T >
Deserialize object of given type from a nuraft::buffer.
auto make_buffer(const T &obj) -> std::enable_if_t< std::is_same_v< B, nuraft::ptr< nuraft::buffer > >, nuraft::ptr< nuraft::buffer > >
Serialize object into nuraft::buffer using a cbdc::nuraft_serializer.
Variant handler template.
Message for replicating a prepare request.