Skip to content

Commit

Permalink
Version bump; documented new pointer format
Browse files Browse the repository at this point in the history
  • Loading branch information
calebsander committed Sep 5, 2017
1 parent b798214 commit 127422c
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 11 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,11 @@ In the following definitions, `type` means the binary type format.
- If `valueIsNonNull`:
- `value` - value serialized by `typeIfNonNull`
- `PointerType`:
- `index` of value in buffer (note: if buffer contains both a type and a value, this index is relative to the start of the value data) - 32-bit unsigned integer
- `offset` - `flexInt`:
- If this is the first instance of these value bytes in the write buffer, then `0`
- Otherwise, ([position of first byte of `offset`] - [position of first byte of `offset` in the last instance of these value bytes])
- If `offset` is `0` (i.e. this is the first instance):
- Value serialized by `targetType`

## Versioning
Versions will be of the form `x.y.z`. They are in the `semver` format:
Expand Down
2 changes: 1 addition & 1 deletion compiled/download.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compiled/upload-download.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compiled/upload.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as base64 from 'base64-js'

const VERSION = 11
const VERSION = 12
const VERSION_BYTES = 2
const VERSION_BUFFER = new ArrayBuffer(VERSION_BYTES)
new DataView(VERSION_BUFFER).setUint16(0, VERSION)
Expand Down
2 changes: 1 addition & 1 deletion dist/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base64 = require("base64-js");
const VERSION = 11;
const VERSION = 12;
const VERSION_BYTES = 2;
const VERSION_BUFFER = new ArrayBuffer(VERSION_BYTES);
new DataView(VERSION_BUFFER).setUint16(0, VERSION);
Expand Down
10 changes: 9 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,15 @@ <h3 id="value">Value</h3>
</ul>
</li>
<li><code>PointerType</code>:<ul>
<li><code>index</code> of value in buffer (note: if buffer contains both a type and a value, this index is relative to the start of the value data) - 32-bit unsigned integer</li>
<li><code>offset</code> - <code>flexInt</code>:<ul>
<li>If this is the first instance of these value bytes in the write buffer, then <code>0</code></li>
<li>Otherwise, ([position of first byte of <code>offset</code>] - [position of first byte of <code>offset</code> in the last instance of these value bytes])</li>
</ul>
</li>
<li>If <code>offset</code> is <code>0</code> (i.e. this is the first instance):<ul>
<li>Value serialized by <code>targetType</code></li>
</ul>
</li>
</ul>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/_config_.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h2>Variables</h2>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="version" class="tsd-anchor"></a>
<h3>VERSION</h3>
<div class="tsd-signature tsd-kind-icon">VERSION<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">11</span><span class="tsd-signature-symbol"> =&nbsp;11</span></div>
<div class="tsd-signature tsd-kind-icon">VERSION<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">12</span><span class="tsd-signature-symbol"> =&nbsp;12</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in config.ts:3</li>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "structure-bytes",
"version": "15.0.2",
"version": "16.0.0",
"description": "A library for more efficient data transfers by separating the structure from the values and storing each as binary data",
"main": "dist/index.js",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions test/type-bytes/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from '../../dist/lib/assert'
import * as t from '../../dist'

export = () => {
assert.equal(new t.ByteType().getSignature(), 'AAs=S/USLzRFVMU73i67jNK349FgCtYxw4Wl18ziPHeFRZo=')
assert.equal(new t.ByteType().getSignature(), 'AAw=S/USLzRFVMU73i67jNK349FgCtYxw4Wl18ziPHeFRZo=')
const type = new t.StructType({
bcd: new t.PointerType(
new t.OptionalType(
Expand All @@ -21,5 +21,5 @@ export = () => {
)
})
assert.equal(type.getHash(), 'YwJi4ZvHdopqQNW0lf2i8zQ37DEDMWmT9gFoqInimHw=')
assert.equal(type.getSignature(), 'AAs=YwJi4ZvHdopqQNW0lf2i8zQ37DEDMWmT9gFoqInimHw=')
assert.equal(type.getSignature(), 'AAw=YwJi4ZvHdopqQNW0lf2i8zQ37DEDMWmT9gFoqInimHw=')
}

0 comments on commit 127422c

Please sign in to comment.