Skip to content

Commit

Permalink
Tag-Rename: to be compliant with IANA CBOR-TAGS #1.
Browse files Browse the repository at this point in the history
Following is the map from old-tags to new-tags:

tag-37 -> tag-43
tag-38 -> tag-44
tag-39 -> tag-45
tag-40 -> tag-46
tag-41 -> tag-47

It doesn't have any impact in memory foot-print or performance.
But breaks compatibility with older-version of gofast.
  • Loading branch information
prataprc committed Jun 29, 2017
1 parent f7dd76d commit f4e4c06
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ the following format:
called opaque-space.
* **Opaque-space should not start before 256**.
* Tag2, Tag3 can be one of the values predefined by this library.
* Final embedded tag, in this case tag4, shall always be tagMsg (value 37).
* Final embedded tag, in this case tag4, shall always be tagMsg (value 43).

**hdr-data**

Expand Down Expand Up @@ -164,20 +164,20 @@ tag values will speed-up frame encoding and decoding.
`tag-8`
TagFinish, following is tagged CBOR breakstop (0xff) item.

`tag-37`
`tag-43`
TagMsg, following CBOR map carries message header and data.

`tag-38`
`tag-44`
TagId, used as key in CBOR header-data mapping to unique message ID.

`tag-39`
`tag-45`
TagData, used as key in CBOR header-data mapping to message, binary
encoded as CBOR byte-array.

`tag-40`
`tag-46`
TagGzip, following CBOR byte array is compressed using gzip encoding.

`tag-41`
`tag-47`
TagLzw, following CBOR byte array is compressed using gzip encoding.

These reserved tags are not part of CBOR specification or IANA registry,
Expand Down
12 changes: 6 additions & 6 deletions cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ const ( // pre-defined tag values
tagRegexp // PCRE and ECMA262 regular expression
tagMime // MIME defined by rfc2045

// tag 37 (unassigned as per spec). says payload is encoded message
// tag 43 (unassigned as per spec). says payload is encoded message
// that shall be passed on to the subscribed handler.
tagMsg
// tag 38 (unassigned as per spec). place-holder for "id" header key.
tagMsg = iota + 25
// tag 44 (unassigned as per spec). place-holder for "id" header key.
tagId
// tag 39 (unassigned as per spec). place-holder for "data" header key.
// tag 45 (unassigned as per spec). place-holder for "data" header key.
tagData
// tag 40 (unassigned as per spec). says payload is compressed using
// tag 46 (unassigned as per spec). says payload is compressed using
// Gzip compression method.
tagGzip
// tag 41 (unassinged as per spec). says payload is compressed using
// tag 47 (unassinged as per spec). says payload is compressed using
// Lzw compression method.
tagLzw

Expand Down
12 changes: 6 additions & 6 deletions example/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ const ( // pre-defined tag values
tagRegexp // PCRE and ECMA262 regular expression
tagMime // MIME defined by rfc2045

// tag 37 (unassigned as per spec). says payload is encoded message
// tag 43 (unassigned as per spec). says payload is encoded message
// that shall be passed on to the subscribed handler.
tagMsg
// tag 38 (unassigned as per spec). place-holder for "id" header key.
tagMsg = iota + 28
// tag 44 (unassigned as per spec). place-holder for "id" header key.
tagId
// tag 39 (unassigned as per spec). place-holder for "data" header key.
// tag 45 (unassigned as per spec). place-holder for "data" header key.
tagData
// tag 40 (unassigned as per spec). says payload is compressed using
// tag 46 (unassigned as per spec). says payload is compressed using
// Gzip compression method.
tagGzip
// tag 41 (unassinged as per spec). says payload is compressed using
// tag 47 (unassinged as per spec). says payload is compressed using
// Lzw compression method.
tagLzw

Expand Down
12 changes: 6 additions & 6 deletions perf/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ const ( // pre-defined tag values
tagRegexp // PCRE and ECMA262 regular expression
tagMime // MIME defined by rfc2045

// tag 37 (unassigned as per spec). says payload is encoded message
// tag 43 (unassigned as per spec). says payload is encoded message
// that shall be passed on to the subscribed handler.
tagMsg
// tag 37 (unassigned as per spec). place-holder for "version" header key.
tagMsg = iota + 28
// tag 44 (unassigned as per spec). place-holder for "version" header key.
tagId
// tag 39 (unassigned as per spec). place-holder for "data" header key.
// tag 45 (unassigned as per spec). place-holder for "data" header key.
tagData
// tag 40 (unassigned as per spec). says payload is compressed using
// tag 46 (unassigned as per spec). says payload is compressed using
// Gzip compression method.
tagGzip
// tag 41 (unassinged as per spec). says payload is compressed using
// tag 47 (unassinged as per spec). says payload is compressed using
// Lzw compression method.
tagLzw

Expand Down
8 changes: 4 additions & 4 deletions rx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var _ = fmt.Sprintf("dummy")
func TestReadtagp(t *testing.T) {
// read tag and its payload
payload := []byte{
216, 37, 191, 216, 39, 2, 216, 40, 87, 159, 109, 116, 101, 115,
216, 43, 191, 216, 44, 2, 216, 45, 87, 159, 109, 116, 101, 115,
116, 116, 114, 97, 110, 115, 112, 111, 114, 116, 1, 26, 0,
160, 0, 0, 96, 255, 255}
tag, bs := readtp(payload)
Expand All @@ -30,7 +30,7 @@ func TestUnmessage(t *testing.T) {

// read tag and its payload
payload := []byte{
216, 37, 191, 216, 38, 2, 216, 39, 82,
216, 43, 191, 216, 44, 2, 216, 45, 82,
6, 99, 108, 105, 101, 110, 116, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
255}

Expand Down Expand Up @@ -60,7 +60,7 @@ func TestUnmessage(t *testing.T) {
func BenchmarkReadtagp(b *testing.B) {
// read tag and its payload
payload := []byte{
216, 37, 191, 216, 38, 2, 216, 39, 87,
216, 43, 191, 216, 44, 2, 216, 45, 87,
159, 109, 116, 101, 115, 116, 116, 114, 97, 110, 115, 112, 111,
114, 116, 1, 26, 0, 160, 0, 0, 96, 255,
255}
Expand All @@ -77,7 +77,7 @@ func BenchmarkUnmessage(b *testing.B) {

// read tag and its payload
payload := []byte{
216, 37, 191, 216, 38, 2, 216, 39, 78,
216, 43, 191, 216, 44, 2, 216, 45, 78,
159, 70, 99, 108, 105, 101, 110, 116, 1, 25, 2, 0, 64, 255,
255}
_, bs := readtp(payload)
Expand Down
4 changes: 2 additions & 2 deletions transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestHeartbeat(t *testing.T) {
transc.SendHeartbeat(10 * time.Millisecond)
time.Sleep(1 * time.Second)
transc.Close()
time.Sleep(20 * time.Millisecond)
time.Sleep(1 * time.Second)
c_counts := transc.Stat()
s_counts := transv.Stat()

Expand All @@ -134,7 +134,7 @@ func TestHeartbeat(t *testing.T) {
t.Errorf("not 100, not 99, not 98: %v", n)
}

ref, since := (200 * time.Millisecond), transv.Silentsince()
ref, since := (1100 * time.Millisecond), transv.Silentsince()
if since > ref {
t.Errorf("expected less than %v, got %v", ref, since)
}
Expand Down
22 changes: 11 additions & 11 deletions tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func TestPost(t *testing.T) {
transv := <-serverch

ref := []byte{
217, 217, 247, 198, 88, 35, 217, 1, 12, 88, 30, 216, 37, 191,
216, 38, 25, 16, 2, 216, 39, 82,
217, 217, 247, 198, 88, 35, 217, 1, 12, 88, 30, 216, 43, 191,
216, 44, 25, 16, 2, 216, 45, 82,
6, 99, 108, 105, 101, 110, 116, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
255,
}
Expand All @@ -37,8 +37,8 @@ func TestRequest(t *testing.T) {
transv := <-serverch

ref := []byte{
217, 217, 247, 129, 88, 35, 217, 1, 12, 88, 30, 216, 37, 191,
216, 38, 25, 16, 2, 216, 39, 82,
217, 217, 247, 129, 88, 35, 217, 1, 12, 88, 30, 216, 43, 191,
216, 44, 25, 16, 2, 216, 45, 82,
6, 99, 108, 105, 101, 110, 116, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
255,
}
Expand All @@ -61,8 +61,8 @@ func TestResponse(t *testing.T) {
transv := <-serverch

ref := []byte{
217, 217, 247, 129, 88, 35, 217, 1, 12, 88, 30, 216, 37, 191,
216, 38, 25, 16, 2, 216, 39, 82,
217, 217, 247, 129, 88, 35, 217, 1, 12, 88, 30, 216, 43, 191,
216, 44, 25, 16, 2, 216, 45, 82,
6, 99, 108, 105, 101, 110, 116, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
255,
}
Expand All @@ -85,8 +85,8 @@ func TestStart(t *testing.T) {
transv := <-serverch

ref := []byte{
217, 217, 247, 159, 88, 35, 217, 1, 12, 88, 30, 216, 37, 191, 216,
38, 25, 16, 2, 216, 39, 82,
217, 217, 247, 159, 88, 35, 217, 1, 12, 88, 30, 216, 43, 191, 216,
44, 25, 16, 2, 216, 45, 82,
6, 99, 108, 105, 101, 110, 116, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
255,
}
Expand All @@ -109,8 +109,8 @@ func TestStream(t *testing.T) {
transv := <-serverch

ref := []byte{
217, 217, 247, 199, 88, 35, 217, 1, 12, 88, 30, 216, 37, 191, 216, 38,
25, 16, 2, 216, 39, 82,
217, 217, 247, 199, 88, 35, 217, 1, 12, 88, 30, 216, 43, 191, 216, 44,
25, 16, 2, 216, 45, 82,
6, 99, 108, 105, 101, 110, 116, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
255,
}
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestFramePkt(t *testing.T) {
transv := <-serverch

ref := []byte{
88, 35, 217, 1, 12, 88, 30, 216, 37, 191, 216, 38, 25, 16, 2, 216, 39,
88, 35, 217, 1, 12, 88, 30, 216, 43, 191, 216, 44, 25, 16, 2, 216, 45,
82, 6, 99, 108, 105, 101, 110, 116, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
255,
}
Expand Down

0 comments on commit f4e4c06

Please sign in to comment.