Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-04.txt
Vadim Goncharov <vadimnuclight@gmail.com> Tue, 17 January 2023 17:46 UTC
Return-Path: <vadimnuclight@gmail.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D27CFC152565 for <cbor@ietfa.amsl.com>; Tue, 17 Jan 2023 09:46:12 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xJSFLsIGZH3F for <cbor@ietfa.amsl.com>; Tue, 17 Jan 2023 09:46:10 -0800 (PST)
Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9CCDDC1524DE for <cbor@ietf.org>; Tue, 17 Jan 2023 09:46:10 -0800 (PST)
Received: by mail-ej1-x62d.google.com with SMTP id hw16so65299818ejc.10 for <cbor@ietf.org>; Tue, 17 Jan 2023 09:46:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Josr3MLTjgjkDyRk5G4hU452LMC1l2PqPXR8R22YT6A=; b=E6y8urMpw1c2j2d1CN42r90gN2WTF5rdf6zMjw2PIwkBbDbGvSp6mCWbVbLzGCQHLW aTHsI0q+wcKkFHbbZ2r1qxLtjKqwbCJ9q/ScBxJYd2btON0uURz4ncIrsYKfwODC4i93 D62hiXh9npHQACLmOFWjFlQv1TBEYdgUtpJ0d/RkB5uRWxv7y8s9X9GoPCX3sJgxLOeG lFkZc6Kpbypm4BTP80aAndiqNgOCCzGCyjyaRWD4A526vWxV7gUpmBzpKZVhxXq7ynaZ qrXqEAqymOTZhrYctmOigVVsdqb+89WPCHKWS7gusDjaDFXNFMdhvB/4mmu/9crh4dbV ifxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Josr3MLTjgjkDyRk5G4hU452LMC1l2PqPXR8R22YT6A=; b=6hJRVd4Uwu/DdnOoTy6E6SHEj7GMii2nnOHGQ3KqXtC8gRwg0PAMhblNvdS/lzm+hL 0NANHjaF2TXXPAjLt8E6plE2Rr/y2IeZaFmssu8e7mx0WHdYiUEIlRXbnEUu2Bg5r4cI HkGFKD/iH134Oyua71flGZZhTlfAF/1XPKz6Ggj5OLPQds5N6cWHwU5WVw5bDWLODtFw Y+tPSysCLM+bM1K4OYAitt8dhg4dmpSneAbeDnSpqKZmL9z/Pqk4aIz5ZD1XRH5Jiyxo eI+b4E6KJYZuRfIy/yB5oot6GIN17ITCha5KfbIn/9JuNFnz2GrkUz5H7s0cE71ZHRW0 D4hQ==
X-Gm-Message-State: AFqh2kpNsHCvNPMZOE5GTVPqMMML2jLBlxyPgJwTqZP1HZqxFkx4boLz 2AfAbJjLR9LXEmtEOkk5UeE=
X-Google-Smtp-Source: AMrXdXsUYjyqXv4FqlS4IsurZCO/4dXb0Yj2mvgXNTelzitpzunK0MjP2VGZqSCkiENX1KcRloL/TQ==
X-Received: by 2002:a17:907:515:b0:86a:4bb6:61cc with SMTP id wj21-20020a170907051500b0086a4bb661ccmr3278585ejb.68.1673977569020; Tue, 17 Jan 2023 09:46:09 -0800 (PST)
Received: from nuclight (broadband-77-37-180-193.ip.moscow.rt.ru. [77.37.180.193]) by smtp.gmail.com with ESMTPSA id 9-20020a170906218900b0084cb4d37b8csm13537742eju.141.2023.01.17.09.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 09:46:08 -0800 (PST)
Date: Tue, 17 Jan 2023 20:46:06 +0300
From: Vadim Goncharov <vadimnuclight@gmail.com>
To: Emile Cormier <emile.cormier.jr@gmail.com>
Cc: Carsten Bormann <cabo@tzi.org>, cbor@ietf.org
Message-ID: <20230117204606.2b742f14@nuclight>
In-Reply-To: <CAM70yxAs=9S-H6ve2HfDf5W=f4cKGZ3B=AXJV==vm26ERs9-mg@mail.gmail.com>
References: <167345627851.15097.9738487459393843034@ietfa.amsl.com> <CAM70yxD2Z52JsJ=XHFFrJWFuAEG5oHv-B8gf6zRYVK4fhpDpeQ@mail.gmail.com> <0B9B7A5E-D61E-4B97-9CE5-9A8AE7055F50@tzi.org> <20230117004326.5642c6ab@nuclight> <CAM70yxAs=9S-H6ve2HfDf5W=f4cKGZ3B=AXJV==vm26ERs9-mg@mail.gmail.com>
X-Mailer: Claws Mail 3.19.0 (GTK+ 2.24.33; amd64-portbld-freebsd12.3)
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/tcQ-L-ZRqH6QAzT7IGTSwJjKWvY>
Subject: Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-04.txt
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2023 17:46:12 -0000
Hi,
I don't understand what do you mean by "nesting" and where recursion
is possible at all. Do you mean 1001 tag can contain another 1001
tagged map inside itself? I don't see such evidence in draft.
If your parser already slurps all map at once, then it can emit proper
event (right column of your table) after parsing.
I'd note, however, that draft lacks complete CDDL for tag structure,
probably that may be the cause of confusion.
--
WBR, @nuclight
On Mon, 16 Jan 2023 19:08:32 -0400
Emile Cormier <emile.cormier.jr@gmail.com> wrote:
> On Mon, Jan 16, 2023 at 5:43 PM Vadim Goncharov
> <vadimnuclight@gmail.com> wrote:
>
> > Sounds like it is "inheritance" what is needed - possibility to have
> > "base" tagged map in a big structure with "settings" keys and
> > smaller "inheriting" ones with just timestamps itself.
> >
> > For simplicity "inheritance" could be defined by just combining keys
> > with overriding, e.g. in Perl example:
> >
> > <snip example>
> >
> > To Emile Cormier: then your fixed-size structs can just have a
> > pointer to "base" struct", will it be enough?
> >
>
> By design, my CBOR decoder's parse events can only contain "atoms",
> where "atoms" are entities (e.g. numbers, strings) that are not
> recursive (e.g. maps and arrays). When my decoder detects a map or
> array, it emits a map_start or array_start event. This is a common
> feature of SAX-style parsers.
>
> When my CBOR decoder encounters tags 1001 and 1002, it consumes the
> entire map and emits an extended_time parse event. Tag 1003 is
> decoded into an extended_interval parse event. Both extended_time and
> extended_interval contain all available information in an easily
> accessible manner. A deserializer converting extended_time to a
> std::chrono (or std::tm, or whatever) is agnostic of the underlying
> wire format (CBOR, Msgpack, JSON, etc) and shouldn't have to know
> anything about magic CBOR key values like -3, -6, etc.
>
> The problem right now is that a clock quality attribute can be a
> nested CBOR timestamp, and that nested CBOR timestamp can contain
> clock quality attributes (there is nothing preventing this in the
> draft RFC). Even if I disallow two levels of clock qualities, my
> extended_time is still messy because it contains optional
> clock_quality objects that can optionally contain extended_time. Yuck!
>
> In my proposed tags 1001 thru 1007, I could parse it like this:
>
> Tag 1001 -> Time Point -> extended_time
> Tag 1002 -> TIme Duration -> extended_time
> Tag 1003 -> Time Period -> extended_interval
> Tag 1004 -> Clock Quality -> clock_quality
> Tag 1005 -> Precision Time -> precision_time
> Tag 1006 -> Precision Duration -> precision_time
> Tag 1007 -> Precision Period -> precision_interval
>
> where (simplified):
>
> struct time_length
> {
> number seconds; // number is a variant type that can contain
> floats or integers
> uint64_t subseconds;
> int subsecondsExponent;
> };
>
> struct extended_time
> {
> time_length length;
> time_scale scale; // none (duration), utc, tai
> };
>
> struct extended_interval
> {
> optional<extended_time> start;
> optional<extended_time> end;
> optional<time_length> length;
> };
>
> struct clock_quality
> {
> optional<time_length> uncertainty; // Yay, no recursion!
> optional<time_length> guarantee; // Yay, no recursion!
> optional<uint16_t> variance;
> optional<uint8_t> classification;
> optional<uint8_t> accuracy;
> };
>
> struct precision_time
> {
> extended_time time;
> optional<clock_quality> quality;
> }
>
> struct precision_interval
> {
> optional<precision_time> start;
> optional<precision_time> end;
> optional<precision_time> length;
> }
>
> See in the above how:
> 1. no recursion is involved
> 2. the parse event data structures are tidy with no circular
> dependencies 3. the size of the data structures are known at compile
> time
>
> I hope visualizing how the data is actually stored in intermediate
> parse event structures will help convince folks of the advantages of
> decoupling clock quality from "basic" timestamps.
>
> I sometimes think CBOR goes too far in economizing every possible
> byte over the wire, to the detriment of keeping encoders/decoders
> "stupid" (thus more robust) and not being too taxing on CPU. I
> believe this is one occasion where having an extra byte to carry
> optional clock quality is well worth it.
>
> Cheers,
> Emile
- [Cbor] I-D Action: draft-ietf-cbor-time-tag-04.txt internet-drafts
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Barry Leiba
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Doug Ewell
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Henk Birkholz
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Michael Richardson
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… lgl island-resort.com
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Laurence Lundblade
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Doug Ewell
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Doug Ewell
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Laurence Lundblade
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Laurence Lundblade
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Emile Cormier
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Vadim Goncharov
- Re: [Cbor] I-D Action: draft-ietf-cbor-time-tag-0… Carsten Bormann