poke-devel
[Top][All Lists]
Advanced

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

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


From: Mohammad-Reza Nabipoor
Subject: Re: [PATCH] MI: Replace sequence number with ID
Date: Sat, 7 Aug 2021 18:21:04 +0430

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.

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.

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

That's it!


Regards,
Mohammad-Reza



reply via email to

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