[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] MI: Replace sequence number with ID

From: Jose E. Marchesi
Subject: Re: [PATCH] MI: Replace sequence number with ID
Date: Mon, 09 Aug 2021 23:31:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Hi, Jose.
> On Sat, Aug 07, 2021 at 03:14:16PM +0200, Jose E. Marchesi wrote:
>> Hi Mohammad.
>> > With this new design, each message has an ID. It's an `int64` number.
>> > Requests must have odd IDs >= 1. Responses must have even IDs >= 2.
>> > The `ID == 0` is a special case, useful for reporting errors for
>> > invalid requests. Events must have negative IDs. The client is
>> > responsible for issuing requests with valid IDs; poke will use the
>> > `ID + 1` as the ID of response.
>> What is the motivation for this change?
> Currently each message has a sequence number (which is incremented by poke 
> editor).
> But there are two kinds of messages:
>   1. (Request, Response) pairs
>   2. Events
> For the req-res messages, the initiator is the "client" and for the evenets, 
> the
> initiator is the poke.

Right, so we have two different "namespaces" for message IDs.  One for
responses and events (poke initiated) and another one for requests
(client initiated).

> So, it makes more sense to deal with these two kinds of interactions 
> differently.
> With this new design, poke uses negative numbers to assign an identity to each
> event, and client uses odd numbers to identify requests, and pokes responds 
> with
> even IDs.

Hmmm, isn't this negative/even/odd schema a bit overcomplicated?  Whats
wrong with using positive consecutive numbers in both namespaces?

Like, requests will be IDed like 0, 1, 2, 3, ...
Also, responses and events will be IDed like 0, 1, 2, 3, ...

> Writing tests is also easier with this new approach. Keeping track of IDs for
> requests and events is much easier.

How so?  Responses to requests always refer explicitly to the request
they are responding to...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]