Class BowireHubRegistry

Namespace
Kuestenlogik.Bowire.AgentHub
Assembly
Kuestenlogik.Bowire.dll

The hub's list of agents (#128): kept in memory, keyed on (serviceName, instanceId) so a heartbeat updates rather than duplicates. An agent is live while its last registration is younger than three of its own heartbeat intervals (or the hub's TTL when it did not say); a stale one stays listed, marked, until it has been silent for ten times that, then it is dropped.

public sealed class BowireHubRegistry
Inheritance
BowireHubRegistry
Inherited Members

Remarks

Memory only, on purpose: agents push, so a restarted hub is whole again after one heartbeat interval, and there is no second copy of the fleet to go stale.

Constructors

BowireHubRegistry(TimeProvider?, TimeSpan?)

The hub's list of agents (#128): kept in memory, keyed on (serviceName, instanceId) so a heartbeat updates rather than duplicates. An agent is live while its last registration is younger than three of its own heartbeat intervals (or the hub's TTL when it did not say); a stale one stays listed, marked, until it has been silent for ten times that, then it is dropped.

public BowireHubRegistry(TimeProvider? clock = null, TimeSpan? defaultTtl = null)

Parameters

clock TimeProvider
defaultTtl TimeSpan?

Remarks

Memory only, on purpose: agents push, so a restarted hub is whole again after one heartbeat interval, and there is no second copy of the fleet to go stale.

Methods

AgentIdFor(string, string)

A URL-safe id derived from the key, so the same service instance keeps its id across heartbeats and hub restarts.

public static string AgentIdFor(string serviceName, string instanceId)

Parameters

serviceName string
instanceId string

Returns

string

List()

Every agent, live ones first, with the long-silent ones dropped.

public IReadOnlyList<BowireHubAgent> List()

Returns

IReadOnlyList<BowireHubAgent>

Register(BowireAgentRegistration)

Record a registration or heartbeat; returns the agent's id, stable across heartbeats.

public string Register(BowireAgentRegistration registration)

Parameters

registration BowireAgentRegistration

Returns

string

Remove(string)

Forget an agent; false when it was not known.

public bool Remove(string agentId)

Parameters

agentId string

Returns

bool