24#ifndef BINLOG_BCG_TICKET_MANAGER_H
25#define BINLOG_BCG_TICKET_MANAGER_H
Implements atomic ops on BgcTicket object.
Definition: atomic_bgc_ticket.h:43
Represents the Binlog Group Commit Ticket - BGC Ticket.
Definition: bgc_ticket.h:54
static constexpr ValueType first_ticket_value
Minimum allowed value for a ticket.
Definition: bgc_ticket.h:153
Singleton class that manages the grouping of sessions for the Binlog Group Commit (BGC),...
Definition: bgc_ticket_manager.h:218
binlog::BgcTicket get_back_ticket() const
Retrieves the back ticket, which is open to session assignments.
Definition: bgc_ticket_manager.cc:65
std::pair< binlog::BgcTicket, binlog::BgcTicket > pop_front_ticket(BgcTmOptions options=BgcTmOptions::empty)
Closes the current front ticket processing window, pops the front ticket assigned sessions count from...
Definition: bgc_ticket_manager.cc:91
AtomicBgcTicket m_coalesced_ticket
The pointer to the coalesced ticket, 0 means that the coalescing has not been requested yet.
Definition: bgc_ticket_manager.h:376
queue_type m_sessions_per_ticket
The queue keeping the total sessions assigned to each ticket that is closed to assignments (front + o...
Definition: bgc_ticket_manager.h:385
Bgc_ticket_manager()=default
Default constructor.
Bgc_ticket_manager(Bgc_ticket_manager const &)=delete
queue_value_type add_processed_sessions_to_front_ticket(queue_value_type sessions_to_add, const binlog::BgcTicket &ticket)
Sets given session count as processed within the front ticket processing window.
Definition: bgc_ticket_manager.cc:52
AtomicBgcTicket m_back_ticket
The pointer to the ticket that is open to assigning more sessions.
Definition: bgc_ticket_manager.h:369
friend std::ostream & operator<<(std::ostream &out, Bgc_ticket_manager const &to_dump)
Dumps the textual representation of an instance of this class into the given output stream.
Definition: bgc_ticket_manager.h:354
std::string to_string() const
Returns the textual representation of this object.
Definition: bgc_ticket_manager.cc:108
queue_value_type m_back_ticket_sessions_count
The number of sessions assigned to the back ticket.
Definition: bgc_ticket_manager.h:378
Bgc_ticket_manager & operator=(Bgc_ticket_manager &&)=delete
Bgc_ticket_manager(Bgc_ticket_manager &&)=delete
static constexpr size_t max_concurrent_tickets
Maximum allowed number of on-wait tickets and the capacity of the underlying session-count queue.
Definition: bgc_ticket_manager.h:227
binlog::BgcTicket get_coalesced_ticket() const
Retrieves the coalesced ticket, if any coalesce.
Definition: bgc_ticket_manager.cc:69
static Bgc_ticket_manager & instance()
Retrieves the single instance of the class.
Definition: bgc_ticket_manager.cc:128
std::pair< binlog::BgcTicket, binlog::BgcTicket > push_new_ticket(BgcTmOptions options=BgcTmOptions::empty)
Closes the current back ticket to sesssion assignments, pushes the back ticket assgined sessions coun...
Definition: bgc_ticket_manager.cc:74
binlog::BgcTicket assign_session_to_ticket()
Assigns a session to the back ticket.
Definition: bgc_ticket_manager.cc:45
std::uint64_t queue_value_type
Definition: bgc_ticket_manager.h:220
virtual ~Bgc_ticket_manager()=default
Default destructor.
Bgc_ticket_manager & operator=(Bgc_ticket_manager const &)=delete
Bgc_ticket_manager & coalesce()
Coalesces all tickets into a single ticket and opens new processing and assignment windows.
Definition: bgc_ticket_manager.cc:28
queue_value_type m_front_ticket_processed_sessions_count
The number of sessions processed in the front ticket window.
Definition: bgc_ticket_manager.h:380
AtomicBgcTicket m_front_ticket
The pointer to the ticket for which the processing window is active.
Definition: bgc_ticket_manager.h:371
binlog::BgcTicket get_front_ticket() const
Retrieves the front ticket, for which the processing window is open.
Definition: bgc_ticket_manager.cc:61
Definition: decompressing_event_object_istream.cc:31
BgcTmOptions
Enumeration for passing options to Bgc_ticket_manager operations.
Definition: bgc_ticket_manager.h:34
@ inc_session_count
While performing some other operation (e.g.
Definition: options.cc:49