#define QUOTE_DEF(a) QUOTE(a) // allow a #define value to be quoted (e.g. QUOTE(MAJOR_VERSION) )
+#define RT_SIZE 10009 // primary entries in route table (prime) meids hash through this so larger than expected # meids
+ // space deginations in the hash table
+#define RT_MT_SPACE 0 // (integer) message type as the key
+#define RT_NAME_SPACE 1 // enpoint name/address is the key
+#define RT_ME_SPACE 2 // message id is the key
+
#define RMR_MSG_VER 3 // message version this code was designed to handle
// environment variable names we'll suss out
#define ENV_BIND_IF "RMR_BIND_IF" // the interface to bind to for both normal comma and RTG (0.0.0.0 if missing)
#define ENV_RTG_PORT "RMR_RTG_SVC" // the port we'll listen on for rtg connections
#define ENV_SEED_RT "RMR_SEED_RT" // where we expect to find the name of the seed route table
+#define ENV_SEED_MEMAP "RMR_SEED_MEMAP" // where we expect to find the name of the seed route table
#define ENV_RTG_RAW "RMR_RTG_ISRAW" // if > 0 we expect route table gen messages as raw (not sent from an RMr application)
#define ENV_VERBOSE_FILE "RMR_VCTL_FILE" // file where vlevel may be managed for some (non-time critical) functions
#define ENV_NAME_ONLY "RMR_SRC_NAMEONLY" // src in message is name only
uint64_t key; // key used to reinsert this entry into a new symtab
int refs; // number of symtabs which reference the entry
int mtype; // the message type for this list
- int nrrgroups; // number of rr groups to send to
+ int nrrgroups; // number of rr groups to send to (if 0, the meid in a message determines endpoint)
rrgroup_t** rrgroups; // one or more set of endpoints to round robin messages to
} rtable_ent_t;
typedef struct {
void* hash; // hash table.
int updates; // counter of update records received
+ int mupdates; // counter of meid update records received
} route_table_t;
/*
// --------------- ring things -------------------------------------------------
+#define RING_NONE 0 // no options
+#define RING_RLOCK 0x01 // create/destroy the read lock on the ring
+#define RING_WLOCK 0x02 // create/destroy the write lockk on the ring
+
typedef struct ring {
uint16_t head; // index of the head of the ring (insert point)
uint16_t tail; // index of the tail (extract point)
uint16_t nelements; // number of elements in the ring
void** data; // the ring data (pointers to blobs of stuff)
+ int pfd; // event fd for the ring for epoll
+ pthread_mutex_t* rgate; // read lock if used
+ pthread_mutex_t* wgate; // write lock if used
} ring_t;
// --- message ring --------------------------
static void* uta_mk_ring( int size );
+static int uta_ring_config( void* vr, int options );
static void uta_ring_free( void* vr );
static inline void* uta_ring_extract( void* vr );
static inline int uta_ring_insert( void* vr, void* new_data );