Michael Richardson
2017-08-17 03:03:36 UTC
Hi. I was trying to generate some code to implement a YANG model in
CBOR using:
https://tools.ietf.org/html/draft-ietf-core-yang-cbor-05#section-4.2
which quite clearly says that I'm to use a CBOR map type (5). Except that
my understanding of SIDs is that they are deltas for the key part.
(My other problem is that I don't have a SID until the SID document
progresses, but I can use the experimental range for now)
In many languages for which there are easy to use CBOR bindings, ruby,
python, perl, js, java, the CBOR map translates to a hash or directionary.
So I wondered how I could do deltas on keys in such an unordered structure...
My reading of:
https://tools.ietf.org/html/draft-ietf-core-yang-cbor-05#section-4.2
about type 5, and then I read:
https://tools.ietf.org/html/rfc7049#section-3.7
which says:
The CBOR data model for maps does not allow ascribing semantics to
the order of the key/value pairs in the map representation.
so, it seems that the SID concept as described in ietf-core-yang-cbor can not
work using the map type!!!
At first I thought it was just a language binding issue; that I needed
ordered sets of some kind, but no... It violates the above property.
Solutions that I can imagine:
1) use an array of 2-element arrays (requires an extra byte for each inner
array!)
2) use an array 2x the size, and let the application reconstruct things as a
hash after taking in account the SID delta.
3) use one of the discussed point/multi-dimensional-array/etc. structures
that I believe were presented at IETF99... I think draft-jroatch-cbor-tags
was the document.
I think that I favour (2), as being the most expedient and easiest to implement.
--
Michael Richardson <mcr+***@sandelman.ca>, Sandelman Software Works
-= IPv6 IoT consulting =-
CBOR using:
https://tools.ietf.org/html/draft-ietf-core-yang-cbor-05#section-4.2
which quite clearly says that I'm to use a CBOR map type (5). Except that
my understanding of SIDs is that they are deltas for the key part.
(My other problem is that I don't have a SID until the SID document
progresses, but I can use the experimental range for now)
In many languages for which there are easy to use CBOR bindings, ruby,
python, perl, js, java, the CBOR map translates to a hash or directionary.
So I wondered how I could do deltas on keys in such an unordered structure...
My reading of:
https://tools.ietf.org/html/draft-ietf-core-yang-cbor-05#section-4.2
about type 5, and then I read:
https://tools.ietf.org/html/rfc7049#section-3.7
which says:
The CBOR data model for maps does not allow ascribing semantics to
the order of the key/value pairs in the map representation.
so, it seems that the SID concept as described in ietf-core-yang-cbor can not
work using the map type!!!
At first I thought it was just a language binding issue; that I needed
ordered sets of some kind, but no... It violates the above property.
Solutions that I can imagine:
1) use an array of 2-element arrays (requires an extra byte for each inner
array!)
2) use an array 2x the size, and let the application reconstruct things as a
hash after taking in account the SID delta.
3) use one of the discussed point/multi-dimensional-array/etc. structures
that I believe were presented at IETF99... I think draft-jroatch-cbor-tags
was the document.
I think that I favour (2), as being the most expedient and easiest to implement.
--
Michael Richardson <mcr+***@sandelman.ca>, Sandelman Software Works
-= IPv6 IoT consulting =-