summaryrefslogtreecommitdiff
path: root/src/irmd/registry.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2020-03-08 13:29:21 +0100
committerSander Vrijders <[email protected]>2020-03-15 14:20:38 +0100
commitc80c93f11dbfb1b0c07f9a6f8b8d91024e5db507 (patch)
treec6ac06aa8841bcb4a403507deda4401594d5cdbe /src/irmd/registry.c
parent8796a612f0600fc973aa908b84ded837f3470512 (diff)
downloadouroboros-c80c93f11dbfb1b0c07f9a6f8b8d91024e5db507.tar.gz
ouroboros-c80c93f11dbfb1b0c07f9a6f8b8d91024e5db507.zip
irm: Revise naming API
This revises the naming API to treat names (or reg_name in the source) as first-class citizens of the architecture. This is more in line with the way they are described in the article. Operations have been added to create/destroy names independently of registering. This was previously done only as part of register, and there was no way to delete a name from the IRMd. The create call now allows specifying a policy for load-balancing incoming flows for a name. The default is the new round-robin load-balancer, the previous behaviour is still available as a spillover load-balancer. The register calls will still create a name if it doesn't exist, with the default round-robin load-balancer. The tools now have a "name" section, so the format is now irm name <operation> <name> ... Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/irmd/registry.c')
-rw-r--r--src/irmd/registry.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/irmd/registry.c b/src/irmd/registry.c
index ef0bc8cc..66cc5af3 100644
--- a/src/irmd/registry.c
+++ b/src/irmd/registry.c
@@ -32,7 +32,6 @@
#include <ouroboros/errno.h>
#include <ouroboros/logs.h>
-#include <ouroboros/irm.h>
#include <ouroboros/time_utils.h>
#include "registry.h"
@@ -72,7 +71,8 @@ static int reg_entry_init(struct reg_entry * e,
list_head_init(&e->reg_progs);
list_head_init(&e->reg_pids);
- e->name = name;
+ e->name = name;
+ e->pol_lb = 0;
if (pthread_condattr_init(&cattr))
goto fail_cattr;
@@ -286,7 +286,17 @@ int reg_entry_add_pid(struct reg_entry * e,
i->pid = pid;
- list_add(&i->next, &e->reg_pids);
+ /* load balancing policy assigns queue order for this process. */
+ switch(e->pol_lb) {
+ case LB_RR: /* Round robin policy. */
+ list_add_tail(&i->next, &e->reg_pids);
+ break;
+ case LB_SPILL: /* Keep accepting flows on the current process */
+ list_add(&i->next, &e->reg_pids);
+ break;
+ default:
+ assert(false);
+ };
if (e->state == REG_NAME_IDLE ||
e->state == REG_NAME_AUTO_ACCEPT ||
@@ -300,6 +310,13 @@ int reg_entry_add_pid(struct reg_entry * e,
return 0;
}
+void reg_entry_set_policy(struct reg_entry * e,
+ enum pol_balance p)
+{
+ e->pol_lb = p;
+}
+
+
static void reg_entry_check_state(struct reg_entry * e)
{
assert(e);