Skip to content

Commit

Permalink
Fixed RidBag Tree deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Jun 29, 2018
1 parent f096fd9 commit 6a6f74f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
14 changes: 6 additions & 8 deletions lib/client/database/bag.js
@@ -1,9 +1,7 @@
/*jshint esversion: 6 */
"use strict";


class ORidBag {

constructor(delegate) {
this.delegate = delegate;
this[Symbol.iterator] = function*() {
Expand All @@ -16,19 +14,16 @@ class ORidBag {
};
}


size() {
return this.delegate.size();
}


push(rid) {
this.delegate.push(rid);
}
}

class OEmbeddedRidBag {

constructor() {
this.entries = [];
this[Symbol.iterator] = function*() {
Expand All @@ -47,11 +42,14 @@ class OEmbeddedRidBag {
}
}
class OSBTreeRidBag {
constructor({ size }) {
this.size = size;
}

size() {
return this.size;
}
}
exports.ORidBag = ORidBag;
exports.OEmbeddedRidBag = OEmbeddedRidBag;
exports.OSBTreeRidBag = OSBTreeRidBag;



13 changes: 12 additions & 1 deletion lib/client/network/protocol37/deserializer-binary.js
Expand Up @@ -331,7 +331,18 @@ function parseRidBag(input, offset) {
}
// Tree
} else {
bag = new ORidBag(new OSBTreeRidBag());
let fileId = parseNumber(input, offset);
offset += fileId.read;
let pageIndex = parseNumber(input, offset);
offset += pageIndex.read;
let pageOffset = parseNumber(input, offset);
offset += pageOffset.read;
let size = parseNumber(input, offset);
offset += size.read;
let changes = parseNumber(input, offset);
offset += changes.read;

bag = new ORidBag(new OSBTreeRidBag({ size: size.value }));
}

return { read: offset - baseOffset, value: bag };
Expand Down

0 comments on commit 6a6f74f

Please sign in to comment.