Re: [Cbor] Review of draft-bormann-cbor-sequence

Carsten Bormann <cabo@tzi.org> Mon, 22 July 2019 22:09 UTC

Return-Path: <cabo@tzi.org>
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 4C0131200B9; Mon, 22 Jul 2019 15:09:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.197
X-Spam-Level:
X-Spam-Status: No, score=-4.197 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4qB5aaODe7GX; Mon, 22 Jul 2019 15:09:04 -0700 (PDT)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8F9661200B8; Mon, 22 Jul 2019 15:09:04 -0700 (PDT)
Received: from client-0195.vpn.uni-bremen.de (client-0195.vpn.uni-bremen.de [134.102.107.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 45swk602k4zyXT; Tue, 23 Jul 2019 00:09:01 +0200 (CEST)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <0ACC3867-2495-48E1-981C-78DEC6D23869@felipegasper.com>
Date: Mon, 22 Jul 2019 18:09:00 -0400
Cc: Sean Leonard <dev+ietf@seantek.com>, draft-bormann-cbor-sequence@ietf.org, cbor@ietf.org, Jim Schaad <ietf@augustcellars.com>
X-Mao-Original-Outgoing-Id: 585526138.540789-4c12ccaa1f736d1d3c767da0e34bf4cb
Content-Transfer-Encoding: quoted-printable
Message-Id: <9051844B-893F-404C-B531-811317CE3BC0@tzi.org>
References: <01f201d50ac9$d6b1abd0$84150370$@augustcellars.com> <CA0F439A-A578-4AE5-9E05-1277FF949997@tzi.org> <0e8901d52f6c$08291060$187b3120$@augustcellars.com> <4AF53D16-C6AE-4D53-9A3A-DF442D827D86@felipegasper.com> <0eb801d52faa$f118fc70$d34af550$@augustcellars.com> <8B5D53CC-0450-4D05-9632-6F31C17E9E74@felipegasper.com> <1A00546C-1EC9-4D80-A6E4-7479D2D6B16F@seantek.com> <0ACC3867-2495-48E1-981C-78DEC6D23869@felipegasper.com>
To: Felipe Gasper <felipe@felipegasper.com>
X-Mailer: Apple Mail (2.3445.9.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/Btpu3H942psyvAas-8HsUOx8x5M>
Subject: Re: [Cbor] Review of draft-bormann-cbor-sequence
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
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: Mon, 22 Jul 2019 22:09:07 -0000

On Jul 22, 2019, at 17:35, Felipe Gasper <felipe@felipegasper.com>; wrote:
> 
> Given that, as you observe, simple concatenation differs from an indefinite-length array only in the leading/trailing bytes, I still don’t see the use case for a stream of CBOR items that doesn’t indicate either a start or an end. It seems like it would be analogous to WebSocket without a close handshake:

Exactly.

(It also saves a byte or two, which may be interesting in some applications.)

> what is the advantage, versus having a built-in mechanism that defines the end of the stream?
> 
> An advantage of defining sequences as merely a special case of indefinite-length arrays (maybe with a tag) is that an ordinary CBOR encoder and decoder can then parse/encode the stream:

Yes.  So we don’t have to do anything — this can already be done by application/cbor and application/…+cbor (as, e.g. SenML does).
The cbor-sequence draft is for the cases that could benefit from the abbreviated/unpacked version.

> either per item if it’s capable, or as a single blob otherwise. The same workflow as for an indefinite-length array—fork off processing per item in the decoder, chunked output in the encoder—will serve the sequence use case.

Applications will continue to be able to opt for this, and I’m sure many will do.

Grüße, Carsten

> 
> -F
> 
>> On Jul 22, 2019, at 17:15, Sean Leonard <dev+ietf@seantek.com>; wrote:
>> 
>> Basically, I believe it’s because you want to enable simple concatenation semantics to add more stuff to the sequence. A sequence is potentially multiple CBOR items strung together. An indefinite-length CBOR array with a terminating byte is a single CBOR item; it can’t be augmented by streaming more data at the end (then, naturally, the data becomes multiple CBOR items).
>> 
>> You can turn a CBOR sequence into a single CBOR data item by prepending the array tag of definite length, or prepending the array tag of indefinite length and appending the terminating byte. This is cheap because it’s just part of “initializing” and “finalizing” the decoder. But when the data is coming across ad infinitum on the wire, you never actually want that terminating byte in the data stream. (At the same time, once you get a single CBOR data item, you want to fork off processing of that single data item rather than keeping the top-level decoder running, looking for said terminating byte.)
>> 
>> Sean
>> 
>>> On Jul 1, 2019, at 4:11 AM, Felipe Gasper <felipe@felipegasper.com>; wrote:
>>> 
>>> Sorry, I was asking a more general question about the proposed CBOR sequence format rather than engaging your point.
>>> 
>>> I realize I should have started a new thread--my apologies for the confusion.
>>> 
>>> I’m just a bit surprised that CBOR sequences are (proposed to be) defined this way. It seems to me that CBOR has no real need for such a standard, precisely because of the indefinite-length arrays that the format itself includes. I would have thought it more logical to define a specific tag that indicates such a structure; thus, a CBOR sequence would itself also be a valid CBOR data object.
>>> 
>>> Thank you!
>>> 
>>> -FG
>>> 
>>>> On Jun 30, 2019, at 9:18 PM, Jim Schaad <ietf@augustcellars.com>; wrote:
>>>> 
>>>> This is the text I was referring to
>>>> 
>>>> An
>>>> implementation may be able to recover from some errors in a sequence
>>>> of bytes that is almost, but not entirely a well-formed encoded CBOR
>>>> data item.
>>>> 
>>>> -----Original Message-----
>>>> From: CBOR <cbor-bounces@ietf.org>; On Behalf Of Felipe Gasper
>>>> Sent: Sunday, June 30, 2019 2:56 PM
>>>> To: Jim Schaad <ietf@augustcellars.com>;
>>>> Cc: draft-bormann-cbor-sequence@ietf.org; cbor@ietf.org; Carsten Bormann <cabo@tzi.org>;
>>>> Subject: Re: [Cbor] Review of draft-bormann-cbor-sequence
>>>> 
>>>> What is the advantage of defining a CBOR data sequence as a simple concatenation versus a tagged CBOR array of indefinite length?
>>>> 
>>>> Thank you!
>>>> 
>>>> -FG
>>>> 
>>>>> On Jun 30, 2019, at 1:48 PM, Jim Schaad <ietf@augustcellars.com>; wrote:
>>>>> 
>>>>> See below.
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Carsten Bormann <cabo@tzi.org>;
>>>>> Sent: Sunday, June 23, 2019 9:53 AM
>>>>> To: Jim Schaad <ietf@augustcellars.com>;
>>>>> Cc: draft-bormann-cbor-sequence@ietf.org; cbor@ietf.org
>>>>> Subject: Re: Review of draft-bormann-cbor-sequence
>>>>> 
>>>>> Hi Jim,
>>>>> 
>>>>> except for items 3 and 5 below, where I don’t quite agree, I believe I have addressed all your comments as well as the other items that popped up for -00 in Prague and on the mailing list.
>>>>> 
>>>>> Please enjoy at:
>>>>> 
>>>>> Status:   https://datatracker.ietf.org/doc/draft-bormann-cbor-sequence/
>>>>> Htmlized: https://tools.ietf.org/html/draft-bormann-cbor-sequence
>>>>> Diff2:    https://tools.ietf.org/rfcdiff?url2=draft-bormann-cbor-sequence-01.txt
>>>>> 
>>>>> Grüße, Carsten
>>>>> 
>>>>> 
>>>>>> On May 15, 2019, at 04:56, Jim Schaad <ietf@augustcellars.com>; wrote:
>>>>>> 
>>>>>> […]
>>>>>> 3.  Section 2 - I think that I would remove the parenthesis in the 
>>>>>> third paragraph.  This is almost the entire paragraph.
>>>>> 
>>>>> I believe that is useful information, so I don’t think the parenthesis should be removed.
>>>>> 
>>>>> [JLS] I am not suggesting that the sentence be removed, just the parenthesis characters.
>>>>> 
>>>>>> […]
>>>>>> 5.  Section 2 - A program, not the decoder, may also be able to 
>>>>>> recover by decoding individual fields looking for a pattern that 
>>>>>> matches an expected structure.  As an example, looking for a byte 
>>>>>> which corresponds to an array of 3 items and then test decoding to 
>>>>>> see if it works and continue from that point.
>>>>> 
>>>>> The specific recovery actions are out of scope (and the text says so).
>>>>> I don’t think we should give advice here for diagnostic tools beyond what is needed for a true decoder.
>>>>> 
>>>>> [JLS] The problem I have with this argument is that you are actually giving an example - should that example then be deleted?
>>>>> 
>>>>> _______________________________________________
>>>>> CBOR mailing list
>>>>> CBOR@ietf.org
>>>>> https://www.ietf.org/mailman/listinfo/cbor
>>>> 
>>>> _______________________________________________
>>>> CBOR mailing list
>>>> CBOR@ietf.org
>>>> https://www.ietf.org/mailman/listinfo/cbor
>>>> 
>>> 
>>> _______________________________________________
>>> CBOR mailing list
>>> CBOR@ietf.org
>>> https://www.ietf.org/mailman/listinfo/cbor
>> 
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor
> 
>