Commit Graph

5 Commits

Author SHA1 Message Date
Erik Arvidsson
40d164fe47 Go: Encode numbers as strings
Because JSON encoders encode numbers differently we cannot just use
numbers in the output.

This still encodes the NomsKind as numbers.

Towards #749
2015-12-11 16:30:07 -05:00
Rafael Weinstein
e75f5097c7 Allow Map & Set to order by natural ordering of element type if available. 2015-11-16 14:30:30 -08:00
Benjamin Kalman
a6395c62a5 Move newset's chunked_set.go to internal.go and flat_set.go to leaf.go.
I changed the struct names in the previous patch but didn't move the
files, to reduce diff complexity. Now I'm moving them. Nothing changed.
2015-10-28 18:18:30 -07:00
Benjamin Kalman
326a202025 Implement Put for newset, also requiring a moderate refactor.
Previously we had flatSet vs chunkedSet, each implementing the Set
interface, and SetBuilder dealing with this Set interface.

Now we have a chunkedSet interface with setValueChunk and setIndexChunk
implementations, SetBuilder dealing with the chunkedSet interface, and a
Set class which implements Set primitives on top of a chunkedSet.

Of particular note is the introduction of the setChunkStore, an
in-memory cache of setChunks keyed by their refs. This is needed right
now so that we only have a single SetBuilder implementation which chunks
refs, as opposed to 2 SetBuilder implementations, one which chunks refs
and the other chunkedSet instances. Something like it will be needed in
the longer term to implement lazily loading set chunks, however there
will be issues like memory pressure to deal with as well.

Follow-ups to this patch include renaming files to reflect their class
names better, and doing a bit of function/member renaming to better
reflect semantics. I've tried to keep the diff as small as possible.
2015-10-28 17:42:15 -07:00
Benjamin Kalman
f08056555a Add initial version of the new chunked Set implementation.
So far:
- It does not support Put. It can only be constructed with a SetBuilder,
  then queried e.g. Has.
- It only supports ref.Refs as values.
- I'm not convinced about the naming. Perhaps SetChunker rather than
  SetBuilder, FlatLevel rather that FlatSet, etc. I expect they will change.
- The test is fairly simplistic but there isn't much point testing this
  exhaustively, since once we support mutation, the testing abstraction
  will probably be with an Iterator.
2015-10-26 11:15:27 -07:00