|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
#include <SubscriptionTracker.hpp>
Public Types | |
| using | Table = std::pair<uint8_t, uint8_t> |
| using | Clock = std::chrono::steady_clock |
Public Member Functions | |
| SubscriptionTracker (std::chrono::milliseconds retry_after=std::chrono::seconds(1)) | |
| uint8_t | assign (Table table) |
| The request id to subscribe table under. | |
| Table | rejected (uint8_t request_id, Clock::time_point now) |
| The DB refused the subscription sent under request_id. | |
| std::vector< Table > | due (Clock::time_point now) |
| Refused tables whose wait is over; each is forgotten here until rejected again. | |
| size_t | refused () const |
| Tables currently waiting to be asked for again. | |
| void | reset () |
| A new connection: every subscription is sent afresh. | |
Private Attributes | |
| std::chrono::milliseconds | retry_after_ |
| uint8_t | next_id_ = 1 |
| std::map< uint8_t, Table > | by_id_ |
| std::map< Table, Clock::time_point > | retry_at_ |
Definition at line 36 of file SubscriptionTracker.hpp.
| using fsw::elodin::SubscriptionTracker::Clock = std::chrono::steady_clock |
Definition at line 39 of file SubscriptionTracker.hpp.
| using fsw::elodin::SubscriptionTracker::Table = std::pair<uint8_t, uint8_t> |
Definition at line 38 of file SubscriptionTracker.hpp.
|
inlineexplicit |
Definition at line 41 of file SubscriptionTracker.hpp.
References retry_after_.
|
inline |
The request id to subscribe table under.
Ids rotate through 1..254: 0 is what untracked subscriptions use, and 255 is the backend's subscription fence.
Definition at line 49 of file SubscriptionTracker.hpp.
References by_id_, and next_id_.
Referenced by main(), test_accepted_table_is_never_asked_for_twice(), test_ids_rotate_and_skip_0_and_255(), test_refused_table_is_asked_for_again(), and test_reset_forgets_everything().
|
inline |
Refused tables whose wait is over; each is forgotten here until rejected again.
Definition at line 71 of file SubscriptionTracker.hpp.
References retry_at_.
Referenced by main(), test_accepted_table_is_never_asked_for_twice(), test_refused_table_is_asked_for_again(), and test_reset_forgets_everything().
|
inline |
Tables currently waiting to be asked for again.
Definition at line 85 of file SubscriptionTracker.hpp.
References retry_at_.
Referenced by test_accepted_table_is_never_asked_for_twice(), test_refused_table_is_asked_for_again(), and test_unknown_request_id_names_nothing().
|
inline |
The DB refused the subscription sent under request_id.
Returns the table it was for, so the caller can say which; {0, 0} for an id this tracker did not hand out.
Definition at line 60 of file SubscriptionTracker.hpp.
References by_id_, retry_after_, and retry_at_.
Referenced by main(), test_refused_table_is_asked_for_again(), test_reset_forgets_everything(), and test_unknown_request_id_names_nothing().
|
inline |
A new connection: every subscription is sent afresh.
Definition at line 90 of file SubscriptionTracker.hpp.
References by_id_, and retry_at_.
Referenced by main(), and test_reset_forgets_everything().
|
private |
Definition at line 98 of file SubscriptionTracker.hpp.
Referenced by assign(), rejected(), and reset().
|
private |
Definition at line 97 of file SubscriptionTracker.hpp.
Referenced by assign().
|
private |
Definition at line 96 of file SubscriptionTracker.hpp.
Referenced by rejected(), and SubscriptionTracker().
|
private |
Definition at line 99 of file SubscriptionTracker.hpp.
Referenced by due(), refused(), rejected(), and reset().