* JS: back BatchStore's put-cache with tingodb
tingodb is a pure-JS, file-backed mongodb-api-compatible database.
Before this patch, BatchStore was caching all pending chunks in memory,
which seems unlikely to scale. Putting them in a tingodb spills them to
disk as needed, though we can still iterate them in put-order when it's
time to send them.
Fixes#1349
makeUnionType now flattens and removes duplicate types. With this
change makeUnionType might no longer actually create a union
type in the case there is only one type in the union.
Towards #1491
This allows having a set/map of heterogenous elements/keys. To support
this we have to be able to have a total ordering for all noms values.
The ordering is false < true < -999 < 0 < 999 < "" < "a" < "z" < Hash
In other words, Bool < Number < String < * and for comparing non
primitives we compare the hash of the object.
Fixes#1104Fixes#1312
When we serialize a meta tuple we should serialize it with the Ref value (which includes the type). This is because in the future the sub tree might be of a different type than the current tree.
Towards #1312
A union type is a compound type with 0 or more types.
Its noms serialization is UnionKind, <number-of-types>, T0, ..., TN
Its HRS is T0 | T1 | ... | TN
Towards #1311
This is to support efficient chunk diff. Most of the churn in this patch
comes from updating test expectations, and updating every Ref construction
to include a height and every MetaTuple to include a Ref.
We used to serialize types in two different ways, depending on whether
the type was used as a tag or as a value. Now we serialize it the same
way.
Also, remove makeCompoundType completely.
And remove some dead code.
While this causes the cache to potentially grow infinitely, having a
DataStore keep track of every value it's read or written makes it
simpler to program with. Once RefValues can only come to be by being
read out of a DataStore, we can do away with this altogether.
The big changes here are that DataStore now has a ValueStore, instead
if extending ValueStore. The DataStore constructor now takes a
ValueStore, so that new instances re-use the same ValueStore can be
constructed on Commit. Since callers don't care about that detail,
this change exports NewDataStore(), which still takes a BatchStore.