Thursday, September 10, 2015

Pulse

In deliberating how Clique Space(TM) aware devices (Agent Devices(TM) and other Client Devices(TM) capable of generating viscera Participants), I had to entertain the communications method (synchronous/asynchronous) by which knowledge of state is spread amongst a subset of all Client Devices which are members (or subscribers) to any given subscription.

I have arrived at the notion that a subscription needs both synchronous and asynchronous communication.

A cluster of devices comprising a subscription dynamically grows and shrinks, but any given subscription is managed by a single device known as the given subscription's possessor device. The possessor may cede its authority to another device (this is theoretically though not currently possible), but for any subscription to maintain a stable existence, a subscription must have a single possessor which is known to be the possessor by all other subscribers.

A subscription grows by acquiring subscribers and shrinks by discarding subscribers. The possessor is the first member of a newly created subscription, and the last member of a subscription before it is destroyed. In having this special position in a subscription, the possessor is also responsible for coordinating the synchronous component of the subscription - its pulse.

At set intervals, an instance of the possessor's "pulse motor" emits a pulse message that spreads first to the possessor's nearest subscribers (those with whom the possessor shares synapses with). This pulse message is then relayed in turn to further distant subscribers until every subscriber is informed of the pulse. The pulse contains information about the state being subscribed to, the subscription's membership, and the length of time to wait for the next pulse.

As soon as a subscriber relays its pulse message, it sends a pulse reply. Each pulse reply reverberates around the subscription so every subscriber device knows that every other subscriber device has received the pulse message. This information helps every subscriber device determine whether they want to remain in the subscription or whether they wish to invite or remove other devices.

Updating the subscription's membership is the asynchronous component because any subscriber can assert the addition of any non-subscribing device, or the removal of any currently-subscribing device at any time. These messages, called "assertions" are remembered for between one and two pulse intervals.

The possessor decides whether an assertion will succeed. If this happens, the subscriptions membership will be updated. If the assertion was a member addition, the given subscriber will receive the next and subsequent pulses unless or until another assertion to have it removed succeeds. If the assertion was the removal of a member, the subscriber relating to the assertion will not receive the next or subsequent pulses unless or until another assertion to have it added succeeds.

So, subscriptions have both a synchronous and an asynchronous component, and both these components are vitally important to maintaining a stable cluster of devices which are observing some phenomenon.

No comments:

Post a Comment