Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PID tag type #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions term_to_binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ var Encoder = function() {
// Encode the array as a tuple.
return self.tuple(val);

if((tag === 'pid' || tag === 'p') && valType === 'object')
return self.pid(val);

throw new Error("Unknown tag " + tag.toString() + " for value: " + sys.inspect(val));
}

Expand All @@ -96,6 +99,16 @@ var Encoder = function() {
return result;
}

self.pid = function(x) {
return [
lib.tags.PID,
self.encode(x.node),
lib.uint32(x.id),
lib.uint32(x.serial),
x.creation
];
}

self.buffer = function(x) {
var result = [lib.tags.BINARY];
result.push(lib.uint32(x.length));
Expand Down