Re: [core] Designs to resolve streaming issues in SenML
Michael Koster <michaeljohnkoster@gmail.com> Sat, 16 January 2016 17:53 UTC
Return-Path: <michaeljohnkoster@gmail.com>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 666711A90F7 for <core@ietfa.amsl.com>; Sat, 16 Jan 2016 09:53:10 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.099
X-Spam-Level:
X-Spam-Status: No, score=-1.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, J_CHICKENPOX_54=0.6, MIME_8BIT_HEADER=0.3, SPF_PASS=-0.001] autolearn=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 Z9X5BrOKmIb2 for <core@ietfa.amsl.com>; Sat, 16 Jan 2016 09:53:07 -0800 (PST)
Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com [IPv6:2607:f8b0:400e:c00::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id AB4F31A90F3 for <core@ietf.org>; Sat, 16 Jan 2016 09:53:07 -0800 (PST)
Received: by mail-pf0-x231.google.com with SMTP id q63so138432430pfb.1 for <core@ietf.org>; Sat, 16 Jan 2016 09:53:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=JtcFmWgzoRTr4kXn7JNEl+VBLmjj54BTqwEEDLMBn9g=; b=PkEwx5gbntXT/cU4d1Bnx9yvr8OkEGanW8/TJU5ZKRqNsJxE7X1dTQd0HBAS2KB8yu uxi0ErQjPD54TpZ9OFGOcgGGeu0gO4e6aA0vubJtPJJ7Ka6ovyHdBMMZ43I6VCF9KPBX VsLUq5d94WrHokjfRZuYOL0Cae94XECipaOppVCspGGwwFiehQ8nSpY2ynSkrn+oOaa/ SYFgquni97sBuHduvLB/GTw47r5yK7SLTux3RhbbN/wfRVuh0PKOK4MYP1JF5WHjY9Ti kCcde61Hj7UMeCqRVSEROikS6tNA6V+wfWLzCGoi9SKNmfQhCnvvVV72xrzKRBygukOI ar+A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=JtcFmWgzoRTr4kXn7JNEl+VBLmjj54BTqwEEDLMBn9g=; b=N+CUHJUG9k4akE9I1sXA2jovVPpyj/uX4mEx/qUO4o33YpzWy7bL1s5fRjxss+wRsK r9EVASnzk1rvGojYGzLWNsrCenGFHHkTXwekfwJlkTi16+/u5qSLpPrzH/8HcN4ZWoXk 8TQz3nLH2TaQ1/U8/3YFarhgkK+mjW8rzHHLXTz89WyE9NOXW09J4I9rasrKdTrP4nwp fvxBlP68t8y4KW9jkjkBfGlf5K+kkPomN/rw8038sCt3g8wfjfJ1K5WdDp9+wgaNF/HX ad35if7rxUgohZEhuj2Aas0TPiWA1K658vwE7A9RLY2A/onGsKBJI1dbN1u98zkv/xP5 qqHg==
X-Gm-Message-State: ALoCoQkCA/dlq1YQwAgS9UJj3Pl54RDqz/AIgMdnB8TuflPccr2paNn57Jrn1krcFC0OliKk/O9+VO2VjYzTnfX3T49kU7ecJA==
X-Received: by 10.98.79.4 with SMTP id d4mr23777484pfb.46.1452966787367; Sat, 16 Jan 2016 09:53:07 -0800 (PST)
Received: from [10.0.0.21] (108-201-184-41.lightspeed.sntcca.sbcglobal.net. [108.201.184.41]) by smtp.gmail.com with ESMTPSA id 20sm23213749pfa.5.2016.01.16.09.53.06 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 16 Jan 2016 09:53:06 -0800 (PST)
Content-Type: multipart/alternative; boundary="Apple-Mail=_C2B0A943-0428-47DD-A651-7F9334C4CA52"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
From: Michael Koster <michaeljohnkoster@gmail.com>
In-Reply-To: <CC28D44A-DBC0-446D-90A8-3E329FC3F0AF@gmail.com>
Date: Sat, 16 Jan 2016 09:53:04 -0800
Message-Id: <0D5538ED-D126-4A1B-AFDD-D9D54580D48B@gmail.com>
References: <175A1806-ACB0-4FC7-A318-2A58FF66CDD2@cisco.com> <20160116132751.GB18563@hephaistos.amsuess.com> <CC28D44A-DBC0-446D-90A8-3E329FC3F0AF@gmail.com>
To: Christian Amsüss <c.amsuess@energyharvesting.at>
X-Mailer: Apple Mail (2.2104)
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/q0TvnY8YIF0xBTAB1ms-Htl1AwQ>
Cc: "Cullen Jennings (fluffy)" <fluffy@cisco.com>, core <core@ietf.org>
Subject: Re: [core] Designs to resolve streaming issues in SenML
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 16 Jan 2016 17:53:10 -0000
Here is a concrete proposal. My goal with the collection+senml content format is to create a format for machine hypermedia representations that is roughly analogous to a HTML web page in the web of documents world. The idea was a compact representation that can represent machine hypermedia data, links, and forms and would leverage existing formats and processors; link-format, senml, json. When I started, it looked like SenML was a good base due to what appeared to be an extension mechanism: the element tag that was an artifact of the XML serialization. I didn’t expect it to be removed because I have XML/JSON tools that programmatically generate that style as a lossless XML-JSON transform. This is generally useful because EXI is still a very popular format and in many cases more compact than CBOR. If we can allow the base element to retain this functionality, and put the streaming support in the sequence of top level array elements, it seems like exactly what is needed. It retains backward compatibility with current senml implementations and allows some extensibility at both levels, while supporting sequential processing. I propose to restore the base senml functionality of draft -01 within the base element definition in the new draft, that is to allow measurement data within the base element using the “e” key. To facilitate sequential processing, a topmost structure of array will allow an arbitrary sequence of base element maps and data element arrays as defined in draft -04. Are there any issues with this construction? Best regards, Michael > On Jan 16, 2016, at 7:24 AM, Michael Koster <michaeljohnkoster@gmail.com> wrote: > > Hi Christian, > > 1. > Thanks for the code example! It seems well optimized indeed. > > It also serves to highlight one of the points. > > It’s more than just a matter of me liking my own favorite language (actually library) internal representation of JSON. Most modern libraries produce dictionary and array representations for parsed JSON that work more or less the same way. > > The optimizations you recommend require a new string input parser, where I am using the JSON parser that comes with the library. My point was that I will need to either make my own string parser for SenML or make a re-parser with the state machine I described in order to use -02 + but there is another issue anyway: > > One of the big advantages of using JSON is connecting the embedded world to the web world. To do this in a low-friction way, it’s good to be able to use well known tools and patterns. Streaming JSON > 2. > Thanks also for looking into my code. I could easily use the -02 or -03 in the senml processing as you show. What is missing still from everything after -01 is the element tag that I am re-using to indicate links and forms in the document: > > { > "bn":"/3300/1/", > "e":[ > {"n":"5700","v":"31.3"}, > {"n":"5602","v":"37.1"}, > {"n":"5601","v":"18.3"}, > {"n":"5605"}, > {"n":"5603","v":"0"}, > {"n":"5604","v":"100"}, > {"n":"5750","sv":"Inboard Bearing"} > ], > "l":[ > {"href":"","rel":"self","rt":"temperature","u":"C"}, > {"href":"5700","rt":"currentValue","u":"C"}, > {"href":"5602","rt":"maxValue","u":"C"}, > {"href":"5601","rt":"minValue","u":"C"}, > {"href":"5605","rt":"resetMaxMin"}, > {"href":"5603","rt":"minScale","u":"C"}, > {"href":"5604","rt":"maxScale","u":"C"}, > {"href":"5750","rt":"appType"} > ] > } > > I will think about other designs that do not depend on entity tags in the representation; maybe there is a better design for the content format in general. But I would still like to use SenML. Maybe not extend it but embed it in another new format… > > In the meantime, I don’t have a good alternative yet. > > Best regards, > > Michael > > PS Can we succinctly describe the use case for ordered serial processing of senml+json elements being important? From reading the draft, it seems like the important bit is saving the buffer memory for large responses. Is it a bigger deal with CBOR encoding or less important. > > Is the most important consideration being able to know the base values ahead of the data? > > Also, where is -03? there doesn’t seem to be a version -03 that you all are talking about on the IETF website: > https://tools.ietf.org/html/draft-jennings-core-senml-04 <https://tools.ietf.org/html/draft-jennings-core-senml-04> > > >> On Jan 16, 2016, at 5:27 AM, Christian Amsüss <c.amsuess@energyharvesting.at <mailto:c.amsuess@energyharvesting.at>> wrote: >> >> Hello Cullen, >> >> On Wed, Jan 13, 2016 at 01:57:02PM +0000, Cullen Jennings (fluffy) wrote: >>> The objects can also have the base values right in the object and the >>> base values apply to all the things in the object and any future >>> objects in the array. >>> >>> Appreciate any thoughts people have on pro / cons of the -03 design vs -04 design. >> >> The -03 draft is parsable with minimum RAM: I've assembled a crude >> demo[1] that shows that given a list of known integer-valued resources >> on a device, it is possible to parse incoming SenML-03 with less than 30 >> bytes of state, with support for arbitrary SenML extensions, all legal >> JSON number representations and full URL concatenation semantics. >> >> With the -04 draft, one would have to allocate a buffer for the "n" >> value, because before the object finishes, the "bn" might change later >> in the same object, and change the context in which it needs to be >> interpreted. This could be remedied by making base and entry updates >> mutually exclusive (arguably a less straight-forward design), but as >> things are, I'd prefer -03. >> >> Best regards >> Christian >> >> [1] https://gitlab.com/c.amsuess-energyharvesting/senml-03-streaming-parser-demo/tree/master <https://gitlab.com/c.amsuess-energyharvesting/senml-03-streaming-parser-demo/tree/master> >> >> -- >> Christian Amsüss | Energy Harvesting Solutions GmbH >> founder, system architect | headquarter: >> mailto:c.amsuess@energyharvesting.at <mailto:c.amsuess@energyharvesting.at> | Arbeitergasse 15, A-4400 Steyr >> tel:+43-664-97-90-6-39 | http://www.energyharvesting.at/ <http://www.energyharvesting.at/> >> | ATU68476614 >> _______________________________________________ >> core mailing list >> core@ietf.org <mailto:core@ietf.org> >> https://www.ietf.org/mailman/listinfo/core >
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- [core] Designs to resolve streaming issues in Sen… Cullen Jennings (fluffy)
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Cullen Jennings (fluffy)
- Re: [core] Designs to resolve streaming issues in… Cullen Jennings (fluffy)
- [core] privacy issues (was: Re: Designs to resolv… Stephen Farrell
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- [core] SenML and link-format in RDF (was: Re: Des… Christian Amsüss
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF (was: Re:… Christian Amsüss
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF (was: Re:… Christian Amsüss
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF Carsten Bormann
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster