35 log_error(
"No routes available from msu %d to type %d",
36 sender->
id, type->
id);
41 log_error(
"Error getting endpoint from msu %d", sender->
id);
50 log_error(
"No routes available from msu %d to type %d",
51 sender->
id, type->
id);
56 log_error(
"Error getting shortest queue endpoint from msu %d", sender->
id);
65 log_error(
"No routes available from msu %d to type %d",
66 sender->
id, type->
id);
71 log_error(
"Error getting endpoint with ID %d from msu %d", msu_id, sender->
id);
83 log_error(
"No routes available from msu %d to type %d",
84 sender->
id, type->
id);
92 if (n_rt_endpoints <= 0) {
93 log_error(
"Could not get endpoint with runtime id %d", runtime_id);
97 log(LOG_ROUTING_DECISIONS,
"Sending to one of %d endpoints with correct runtime",
99 *output = eps[((
unsigned int)msg->
hdr.
key.
id) % n_rt_endpoints];
100 log(LOG_ROUTING_DECISIONS,
"Chose endpoint %d (idx: %d)",
101 output->
id, ((
unsigned int)msg->
hdr.
key.
id) % n_rt_endpoints);
int get_endpoint_by_id(struct routing_table *table, int msu_id, struct msu_endpoint *endpoint)
Gets endpoint with the given MSU ID in the provided route.
int id
A unque identifier for the endpoint (msu ID)
int shortest_queue_route(struct msu_type *type, struct local_msu *sender, struct msu_msg *msg, struct msu_endpoint *output)
Chooses the local MSU with the shortest queue.
The core of the routing system, the routing table lists a route's destinations.
int route_to_id(struct msu_type *type, struct local_msu *sender, int msu_id, struct msu_endpoint *output)
Chooses the MSU with the given ID.
int n_endpoints
The number of destinations this route contains.
int default_routing(struct msu_type *type, struct local_msu *sender, struct msu_msg *msg, struct msu_endpoint *output)
The defualt routing strategy, using the key of the MSU message to route to a pre-defined endpoint...
int32_t id
A shorter, often hashed id for the key of fixed length (used in routing)
int get_route_endpoint(struct routing_table *table, uint32_t key, struct msu_endpoint *endpoint)
Gets the endpoint associated with the given key in the provided route.
Logging of status messages to the terminal.
unsigned int id
Unique ID for a local MSU.
struct msu_provinance_item origin
The first MSU to see this message.
int get_endpoints_by_runtime_id(struct routing_table *table, int runtime_id, struct msu_endpoint *endpoints, int n_endpoints)
Gets all of the endpoints in the provided routing table with the right runtime id.
struct route_set routes
Routing table set, containing all destination MSUs (see routing.h for details)
struct msg_provinance provinance
Message history.
unsigned int id
Numerical identifier for the MSU.
#define log_error(fmt,...)
Declares the structures and functions applicable to MSUs on the local machine.
The structure that represents an MSU located on the local machine.
int get_n_endpoints(struct routing_table *table)
struct routing_table * get_type_from_route_set(struct route_set *set, int type_id)
Gets the route from the provided array of routes which has the correct type ID.
static int runtime_id(int runtime_fd)
#define log(level, fmt,...)
Log at a custom level.
A message that is to be delivered to an instance of an MSU.
An endpoint to which an msu_msg can be delivered.
int route_to_origin_runtime(struct msu_type *type, struct local_msu *sender, struct msu_msg *msg, struct msu_endpoint *output)
Routes an MSU message to the runtime on which the message originated.
int get_shortest_queue_endpoint(struct routing_table *table, uint32_t key, struct msu_endpoint *endpoint)
Gets the local endpoint from a route with the shortest queue length.
Declares strategies that MSUs can use for routing to endpoints.
struct msu_msg_key key
Routing/state key.