6#ifndef OPENCBDC_TX_SRC_PARSEC_RUNTIME_LOCKING_SHARD_REPLICATED_SHARD_INTERFACE_H_
7#define OPENCBDC_TX_SRC_PARSEC_RUNTIME_LOCKING_SHARD_REPLICATED_SHARD_INTERFACE_H_
51 = std::unordered_map<ticket_number_type, ticket_type>;
108 [[nodiscard]]
virtual auto
Interface for replicating internal state for prepared and committed tickets managed by a locking shar...
std::function< void(get_tickets_return_type)> get_tickets_callback_type
Callback function type for the result of a get tickets operation.
virtual auto finish(ticket_number_type ticket_number, callback_type result_callback) -> bool=0
Stores a finish request in the state machine.
error_code
Error codes returned by class methods.
@ internal_error
Internal error preventing processing.
@ unknown_ticket
Requested ticket does not exist.
replicated_shard_interface()=default
virtual auto prepare(ticket_number_type ticket_number, broker_id_type broker_id, state_type state_update, callback_type result_callback) -> bool=0
Stores a prepare request for a ticket in the state machine.
std::unordered_map< ticket_number_type, ticket_type > tickets_type
Type for the tickets list returned by the state machine.
std::variant< tickets_type, error_code > get_tickets_return_type
Return type from a get tickets operation.
ticket_state
Ticket states returned by shards for broker recovery purposes.
@ prepared
Prepared, holds locks.
@ committed
Committed, not holding any locks.
virtual ~replicated_shard_interface()=default
std::function< void(return_type)> callback_type
Callback function type for the result of a prepare operation.
std::unordered_map< key_type, value_type, hashing::const_sip_hash< key_type > > state_type
Type for state updates to a shard.
auto operator=(const replicated_shard_interface &) -> replicated_shard_interface &=default
virtual auto get_tickets(get_tickets_callback_type result_callback) const -> bool=0
Retrieves unfinished tickets from the state machine.
std::optional< error_code > return_type
Return type from a prepare operation. An error, if applicable.
virtual auto commit(ticket_number_type ticket_number, callback_type result_callback) -> bool=0
Stores a commit request in the state machine.
buffer key_type
Type for keys held by shards.
parsec::ticket_machine::ticket_number_type ticket_number_type
Type for a ticket number.
size_t broker_id_type
Type for the ID of a broker.
buffer value_type
Type for values held by shards.
std:: unordered_map< key_type, value_type, hashing::const_sip_hash< key_type > > state_update_type
Type for state updates to a shard. A map of keys and their new values.
SipHash function to generate STL data structure hash keys for system IDs.
Ticket date stored in the replicated state machine.
ticket_state m_state
State of the ticket within the PArSEC protocol.
broker_id_type m_broker_id
Broker managing the ticket.
state_update_type m_state_update
State updated to apply after commit.