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.
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 types.Ref can only come to
be by being read out of a DataStore, we can do away with this
altogether.
The goal is to remove places where we construct a types.Ref from a
ref.Ref, so that we can attach a height to it later. This should also
make it unnecessary to read in the Commit values at all (which is the
case in the JS SDK) but commit validation prevents that for now.
We're seeing some raciness in RemoteDataStore tests that don't
repro locally. This adds the hashes of all chunks seen prior to the
failure to the error response sent back by the DataStoreServer.
Hopefully, this will help debug the raciness.
This replaces the HTTP ChunkStore implementation with an implementation of
our new DataStore client protocol. It migrates much of the batching logic
from RemoteStore into the new BatchStore, which is analogous to a class we
have on the Go side, but continues to use a Delegate to handle all the HTTP
work.
This patch also introduces ValueStore, which handles validating Values as
they're written. Instead of handling Value reading and writing itself,
DataStore now extends ValueStore.
Towards #1280