tchannel 3.6.14 → 3.6.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/v2/tracing.js CHANGED
@@ -42,10 +42,11 @@ function Tracing(spanid, parentid, traceid, flags) {
42
42
  this.flags = flags || 0;
43
43
  }
44
44
 
45
- Tracing.RW = bufrw.Base(tracingByteLength, readTracingFrom, writeTracingInto);
45
+ Tracing.RW = bufrw.Base(tracingByteLength, readTracingFrom, writeTracingInto, true);
46
46
 
47
- function tracingByteLength() {
48
- return bufrw.LengthResult.just(
47
+ function tracingByteLength(destResult) {
48
+ return destResult.reset(
49
+ null,
49
50
  8 + // spanid:8
50
51
  8 + // parentid:8
51
52
  8 + // traceid:8
@@ -53,78 +54,78 @@ function tracingByteLength() {
53
54
  );
54
55
  }
55
56
 
56
- function writeTracingInto(tracing, buffer, offset) {
57
+ function writeTracingInto(destResult, tracing, buffer, offset) {
57
58
  var res;
58
59
 
59
- res = bufrw.UInt32BE.writeInto(tracing.spanid[0], buffer, offset);
60
+ res = bufrw.UInt32BE.poolWriteInto(destResult, tracing.spanid[0], buffer, offset);
60
61
  if (res.err) return res;
61
62
  offset = res.offset;
62
63
 
63
- res = bufrw.UInt32BE.writeInto(tracing.spanid[1], buffer, offset);
64
+ res = bufrw.UInt32BE.poolWriteInto(destResult, tracing.spanid[1], buffer, offset);
64
65
  if (res.err) return res;
65
66
  offset = res.offset;
66
67
 
67
- res = bufrw.UInt32BE.writeInto(tracing.parentid[0], buffer, offset);
68
+ res = bufrw.UInt32BE.poolWriteInto(destResult, tracing.parentid[0], buffer, offset);
68
69
  if (res.err) return res;
69
70
  offset = res.offset;
70
71
 
71
- res = bufrw.UInt32BE.writeInto(tracing.parentid[1], buffer, offset);
72
+ res = bufrw.UInt32BE.poolWriteInto(destResult, tracing.parentid[1], buffer, offset);
72
73
  if (res.err) return res;
73
74
  offset = res.offset;
74
75
 
75
- res = bufrw.UInt32BE.writeInto(tracing.traceid[0], buffer, offset);
76
+ res = bufrw.UInt32BE.poolWriteInto(destResult, tracing.traceid[0], buffer, offset);
76
77
  if (res.err) return res;
77
78
  offset = res.offset;
78
79
 
79
- res = bufrw.UInt32BE.writeInto(tracing.traceid[1], buffer, offset);
80
+ res = bufrw.UInt32BE.poolWriteInto(destResult, tracing.traceid[1], buffer, offset);
80
81
  if (res.err) return res;
81
82
  offset = res.offset;
82
83
 
83
- res = bufrw.UInt8.writeInto(tracing.flags, buffer, offset);
84
+ res = bufrw.UInt8.poolWriteInto(destResult, tracing.flags, buffer, offset);
84
85
 
85
86
  return res;
86
87
  }
87
88
 
88
- function readTracingFrom(buffer, offset) {
89
+ function readTracingFrom(destResult, buffer, offset) {
89
90
  var tracing = new Tracing();
90
91
  var res;
91
92
 
92
- res = bufrw.UInt32BE.readFrom(buffer, offset);
93
+ res = bufrw.UInt32BE.poolReadFrom(destResult, buffer, offset);
93
94
  if (res.err) return res;
94
95
  offset = res.offset;
95
96
  tracing.spanid[0] = res.value;
96
97
 
97
- res = bufrw.UInt32BE.readFrom(buffer, offset);
98
+ res = bufrw.UInt32BE.poolReadFrom(destResult, buffer, offset);
98
99
  if (res.err) return res;
99
100
  offset = res.offset;
100
101
  tracing.spanid[1] = res.value;
101
102
 
102
- res = bufrw.UInt32BE.readFrom(buffer, offset);
103
+ res = bufrw.UInt32BE.poolReadFrom(destResult, buffer, offset);
103
104
  if (res.err) return res;
104
105
  offset = res.offset;
105
106
  tracing.parentid[0] = res.value;
106
107
 
107
- res = bufrw.UInt32BE.readFrom(buffer, offset);
108
+ res = bufrw.UInt32BE.poolReadFrom(destResult, buffer, offset);
108
109
  if (res.err) return res;
109
110
  offset = res.offset;
110
111
  tracing.parentid[1] = res.value;
111
112
 
112
- res = bufrw.UInt32BE.readFrom(buffer, offset);
113
+ res = bufrw.UInt32BE.poolReadFrom(destResult, buffer, offset);
113
114
  if (res.err) return res;
114
115
  offset = res.offset;
115
116
  tracing.traceid[0] = res.value;
116
117
 
117
- res = bufrw.UInt32BE.readFrom(buffer, offset);
118
+ res = bufrw.UInt32BE.poolReadFrom(destResult, buffer, offset);
118
119
  if (res.err) return res;
119
120
  offset = res.offset;
120
121
  tracing.traceid[1] = res.value;
121
122
 
122
- res = bufrw.UInt8.readFrom(buffer, offset);
123
+ res = bufrw.UInt8.poolReadFrom(destResult, buffer, offset);
123
124
  if (res.err) return res;
124
125
  offset = res.offset;
125
126
  tracing.flags = res.value;
126
127
 
127
- return bufrw.ReadResult.just(offset, tracing);
128
+ return destResult.reset(null, offset, tracing);
128
129
  }
129
130
 
130
131
  Tracing.emptyTracing = new Tracing();