35#ifndef ut0stateful_latching_rules 
   36#define ut0stateful_latching_rules 
  113template <
typename Node, 
size_t LATCHES_COUNT>
 
  169  template <
typename T>
 
  173    for (
size_t i = 0; i < latches.size(); ++i) {
 
  203      if (
source.count(edge.m_from) && destination.count(edge.m_to) &&
 
  204          (edge.m_latches & forbiden_latches) == 0) {
 
  207          the_err << 
"It is possible to transition from " << edge.m_from
 
  208                  << 
" to " << edge.m_to << 
" holding just ";
 
  209          print(the_err, edge.m_latches);
 
  210          the_err << 
" even when we hold ";
 
  211          print(the_err, forbiden_latches);
 
  228                        std::inserter(other_states, other_states.end()));
 
  261                          std::vector<edge_t> allowed_transitions)
 
  277    const bool can_leave_A = 
can_leave(owned_latches, A);
 
  278    const bool can_leave_B = 
can_leave(owned_latches, B);
 
  280    if (can_leave_A || can_leave_B) {
 
  282      the_err << 
"We can leave " 
  283              << (can_leave_A && can_leave_B ? 
"both A and B" 
  284                                             : (can_leave_A ? 
"A" : 
"B"))
 
  285              << 
" as we only hold: ";
 
  286      print(the_err, owned_latches);
 
  310    const auto missing_latches = ~owned_latches;
 
  313          return (edge.m_from == from && edge.m_to == to) &&
 
  314                 (edge.m_latches & missing_latches) == 0;
 
  319    the_err << 
"Disallowed transition FROM " << from << 
" TO " << to
 
  321    print(the_err, owned_latches);
 
The class error is used to emit error messages.
Definition: ut0log.h:231
 
The class fatal is used to emit an error message and stop the server by crashing it.
Definition: ut0log.h:253
 
This is a generic mechanism for verifying correctness of latching rules for state transitions and que...
Definition: ut0stateful_latching_rules.h:114
 
const nodes_set_t m_states
The set of all possible states.
Definition: ut0stateful_latching_rules.h:159
 
const std::vector< edge_t > m_edges
The list of allowed state transitions.
Definition: ut0stateful_latching_rules.h:162
 
std::bitset< LATCHES_COUNT > latches_set_t
The type for a set of latches - there are LATCHES_COUNT distinct latches, each one corresponds to a f...
Definition: ut0stateful_latching_rules.h:125
 
bool is_transition_possible(const latches_set_t &forbiden_latches, const nodes_set_t &source, const nodes_set_t &destination) const
Checks if another thread could change the state even though we hold some latches.
Definition: ut0stateful_latching_rules.h:199
 
void assert_latches_let_distinguish(const latches_set_t &owned_latches, const nodes_set_t &A, const nodes_set_t &B) const
Checks if owned_latches (presumably held by the current thread) are enough to meaningfully ask a ques...
Definition: ut0stateful_latching_rules.h:274
 
Stateful_latching_rules(nodes_set_t all_states, std::vector< edge_t > allowed_transitions)
Creates a set of rules for allowed_transitions between all_states.
Definition: ut0stateful_latching_rules.h:260
 
nodes_set_t complement(const nodes_set_t &states) const
Computes the complement of the given set of states, that is a set of all of the other states.
Definition: ut0stateful_latching_rules.h:224
 
Node node_t
The type for a state in our automata.
Definition: ut0stateful_latching_rules.h:117
 
std::set< node_t > nodes_set_t
The type for a set of states.
Definition: ut0stateful_latching_rules.h:120
 
void assert_latches_let_distinguish(const latches_set_t &owned_latches, const nodes_set_t &A) const
A convenience function for the special case of.
Definition: ut0stateful_latching_rules.h:296
 
void on_transition(const node_t &from, const node_t &to, const latches_set_t &owned_latches) const
Checks if the transition between given states holding specified latches is allowed by the rules.
Definition: ut0stateful_latching_rules.h:305
 
void print(T &sout, const latches_set_t &latches) const
A helper function which prints the ids of latches from the set of latches to an ostream-like object (...
Definition: ut0stateful_latching_rules.h:170
 
bool can_leave(const latches_set_t &forbiden_latches, const nodes_set_t &source) const
A convenience function for the special case of.
Definition: ut0stateful_latching_rules.h:243
 
#define T
Definition: jit_executor_value.cc:373
 
bool any_of(const Container &c, const Value &value)
Definition: any_of.h:35
 
const char * begin(const char *const c)
Definition: base64.h:44
 
Definition: gcs_xcom_synode.h:64
 
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
 
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42
 
The type for a possible transition from one state to another while holding at least a given set of la...
Definition: ut0stateful_latching_rules.h:129
 
node_t m_to
The new state from to which the transition leads.
Definition: ut0stateful_latching_rules.h:139
 
edge_t(node_t from, std::initializer_list< int > &&idxs, node_t to)
Creates a description of one of allowed state transitions from given state to another while holding g...
Definition: ut0stateful_latching_rules.h:150
 
node_t m_from
The old state from which the transition starts.
Definition: ut0stateful_latching_rules.h:131
 
latches_set_t m_latches
The required subset of latches for this particular transition.
Definition: ut0stateful_latching_rules.h:136
 
#define UT_LOCATION_HERE
Definition: ut0core.h:73
 
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510