The Console entries the Engine owns and the Renderer shows, keyed by UID. The UID is the one stamped on the message the entry describes, so the Engine, the disk log and the Renderer all refer to the same thing. Every change bumps the entry's revision, which lets the Renderer ignore anything older than what it has. The list is bounded; the oldest entries are forgotten first. Safe to use from any thread.
More...
#include <console_list.hpp>
|
| | EntryList (std::size_t capacity=5000) |
| | Creates an empty list.
|
| ConsoleEntry | add (ConsoleEntry entry) |
| | Adds an entry, or returns the one already held under the same UID.
|
| std::optional< Confirmation > | confirm (ConsoleEntry fallback, ProcessKind sender=PROCESS_KIND_UNSPECIFIED, std::uint32_t senderId=0) |
| | Records that a command was received. A direct entry becomes received. A multicast entry becomes received only after all distinct recipients confirm it. If the UID is unknown, the fallback is received for direct messages and pending for multicast.
|
| std::size_t | size () const |
| | Number of entries currently held.
|
|
| void | remember (const ConsoleEntry &entry) |
| | Stores an entry and forgets the oldest ones beyond capacity. The caller holds the lock.
|
|
| std::mutex | _mutex |
| | Guards the entries and their order.
|
| std::size_t | _capacity |
| | Most entries kept.
|
| std::unordered_map< std::string, ConsoleEntry > | _entries |
| | Entries by UID.
|
| std::unordered_map< std::string, std::set< std::pair< ProcessKind, std::uint32_t > > > | _receipts |
| std::deque< std::string > | _order |
| | UIDs oldest first, used to forget the oldest entry.
|
The Console entries the Engine owns and the Renderer shows, keyed by UID. The UID is the one stamped on the message the entry describes, so the Engine, the disk log and the Renderer all refer to the same thing. Every change bumps the entry's revision, which lets the Renderer ignore anything older than what it has. The list is bounded; the oldest entries are forgotten first. Safe to use from any thread.
Definition at line 29 of file console_list.hpp.
◆ EntryList()
| fray::console::EntryList::EntryList |
( |
std::size_t | capacity = 5000 | ) |
|
|
inlineexplicit |
Creates an empty list.
- Parameters
-
| capacity | Most entries kept before the oldest is forgotten; at least one. |
Definition at line 36 of file console_list.hpp.
◆ add()
| ConsoleEntry fray::console::EntryList::add |
( |
ConsoleEntry | entry | ) |
|
|
inline |
Adds an entry, or returns the one already held under the same UID.
- Parameters
-
| entry | Entry to add, in whatever status it already has; its revision is set to 1. |
- Returns
- The entry as held, which is the existing one when the UID was already known.
Definition at line 45 of file console_list.hpp.
◆ confirm()
| std::optional< Confirmation > fray::console::EntryList::confirm |
( |
ConsoleEntry | fallback, |
|
|
ProcessKind | sender = PROCESS_KIND_UNSPECIFIED, |
|
|
std::uint32_t | senderId = 0 ) |
|
inline |
Records that a command was received. A direct entry becomes received. A multicast entry becomes received only after all distinct recipients confirm it. If the UID is unknown, the fallback is received for direct messages and pending for multicast.
- Parameters
-
| fallback | Entry describing the command, used only when its UID is unknown. |
| sender | Process kind that issued the receipt. |
| senderId | Instance ID that issued the receipt. |
- Returns
- What changed, or nullopt if the entry was already received.
Definition at line 76 of file console_list.hpp.
◆ remember()
| void fray::console::EntryList::remember |
( |
const ConsoleEntry & | entry | ) |
|
|
inlineprivate |
Stores an entry and forgets the oldest ones beyond capacity. The caller holds the lock.
- Parameters
-
Definition at line 131 of file console_list.hpp.
◆ size()
| std::size_t fray::console::EntryList::size |
( |
| ) |
const |
|
inline |
◆ _capacity
| std::size_t fray::console::EntryList::_capacity |
|
private |
◆ _entries
| std::unordered_map<std::string, ConsoleEntry> fray::console::EntryList::_entries |
|
private |
◆ _mutex
| std::mutex fray::console::EntryList::_mutex |
|
mutableprivate |
◆ _order
| std::deque<std::string> fray::console::EntryList::_order |
|
private |
UIDs oldest first, used to forget the oldest entry.
Definition at line 153 of file console_list.hpp.
◆ _receipts
| std::unordered_map<std::string, std::set<std::pair<ProcessKind, std::uint32_t> > > fray::console::EntryList::_receipts |
|
private |
Distinct multicast recipients whose receipts have been observed.
Definition at line 151 of file console_list.hpp.
The documentation for this class was generated from the following file: