Methods
-
<static> newResolver(array, remote, serialize, deserialize)
-
Creates a new resolver.
Parameters:
Name Type Description array
Object[] the array containing local items. remote
Summarizer summarizer producing summaires of the remote side. serialize
Serial~Serialize the item serializer. deserialize
Serial~Deserialize the item deserializer. Example
var remote = ... var items = [{ from: 1, to: 2 }, { from: 2, to: 5}]; function serialize(item) { return new Int32Array([item.from, item.to]).buffer; } function deserialize(buffer) { var arr = new Int32Array(buffer); return { from: arr[0], to: arr[1] }; } var summarizer = require('mathsync/array').newResolver(items, remote, serialize, deserialize);
-
<static> newSummarizer(array, serialize, digester, selector)
-
Creates a new summarizer.
Parameters:
Name Type Argument Description array
Object[] the array containing local items. serialize
Serial~Serialize the item serializer. digester
Digest~Digester <optional>
the digester to use, defaults to SHA-1. selector
BucketSelector~Selector <optional>
how to place items in IBF buckets, uses 3 buckets by default. Example
var items = [{ from: 1, to: 2 }, { from: 2, to: 5}]; function serialize(item) { return new Int32Array([item.from, item.to]).buffer; } var summarizer = require('mathsync/array').newSummarizer(items, serialize);