From 37070e5949ae11af9395525187572a137e477fde Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 2 Jan 2023 14:39:33 -0800 Subject: [PATCH 1/2] identify: add a sequence number to the Identify protobuf --- identify/README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/identify/README.md b/identify/README.md index b64ef4887..6f1ea03cb 100644 --- a/identify/README.md +++ b/identify/README.md @@ -5,11 +5,11 @@ | Lifecycle Stage | Maturity Level | Status | Latest Revision | |-----------------|----------------|--------|-----------------| -| 3A | Recommendation | Active | r1, 2021-08-09 | +| 3A | Recommendation | Active | r2, 2023-01-03 | Authors: [@vyzo] -Interest Group: [@yusefnapora], [@tomaka], [@richardschneider], [@Stebalien], [@bigs] +Interest Group: [@yusefnapora], [@tomaka], [@richardschneider], [@Stebalien], [@bigs], [@marten-seemann] [@vyzo]: https://github.com/vyzo [@yusefnapora]: https://github.com/yusefnapora @@ -17,6 +17,7 @@ Interest Group: [@yusefnapora], [@tomaka], [@richardschneider], [@Stebalien], [@ [@richardschneider]: https://github.com/richardschneider [@Stebalien]: https://github.com/Stebalien [@bigs]: https://github.com/bigs +[@marten-seemann]: https://github.com/marten-seemann See the [lifecycle document][lifecycle-spec] for context about the maturity level and spec status. @@ -31,6 +32,7 @@ and spec status. - [`identify`](#identify) - [`identify/push`](#identifypush) - [The Identify Message](#the-identify-message) + - [sequence](#sequence) - [protocolVersion](#protocolversion) - [agentVersion](#agentversion) - [publicKey](#publickey) @@ -74,6 +76,7 @@ whose values have changed. ```protobuf message Identify { + optional uint64 sequence = 7; optional string protocolVersion = 5; optional string agentVersion = 6; optional bytes publicKey = 1; @@ -83,6 +86,13 @@ message Identify { } ``` +### sequence + +A sequence number for this identify message used to deal with reordered Identify +messages. Senders SHOULD increment the sequence number for every Identify message +they send. After processing an Identify with a certain sequence number, receivers +MUST ignore all Identify messages with smaller sequence numbers. + ### protocolVersion The protocol version identifies the family of protocols used by the peer. The From d9de900dfe20329c7424c637c06487a5297bcbb8 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Thu, 16 Feb 2023 17:31:18 +1300 Subject: [PATCH 2/2] identify: recommend using unix timestamp as sequence number --- identify/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/identify/README.md b/identify/README.md index 6f1ea03cb..99ef8fc19 100644 --- a/identify/README.md +++ b/identify/README.md @@ -93,6 +93,10 @@ messages. Senders SHOULD increment the sequence number for every Identify messag they send. After processing an Identify with a certain sequence number, receivers MUST ignore all Identify messages with smaller sequence numbers. +To avoid persisting state across restarts, implementations MAY use unix +epoch time as the `seq` value, however receivers MUST NOT attempt to interpret the +sequence number value as a valid timestamp. + ### protocolVersion The protocol version identifies the family of protocols used by the peer. The