Before encoding a compoundBlob we create a compoundBlobStruct and
encode that instead.
After decoding we check if the value is a compoundBlobStruct and if so
we convert it to a compoundBlob.
Fixes#455, #165
When writing a Package we were writing the type refs describing the
types in Package. These are never referenced from anywhere and the
information is embedded into the Package chunk.
Packages usually gets registered using RegisterPackage which is called
by generated code. However, if the data in the data store was created
using another binary it is unlikely that the current binary registered
the same Package.
When writing values that depends on Packages we write the Package to
the ChunkStore...
When we read a value that depends on a Package and the Package has
not been registered we now read the Package out of the the ChunkStore
and register it for future uses.
When we write a value that has a TypeRef with a package we need to
write that package.
When we write a package that has dependencies we need to write the
dependent packages too.
Ref Values now have a TargetRef() method that returns the ref.Ref of
the target the Value is referencing.
Note: This is a breaking change. In old code the Ref() of the Value was
the Ref of the underlying target.
Fixes#464
The implementation of structs is a Map and we used to reserve a key
with the name "$type" for the TypeRef. This is no longer needed since
the TypeRef is a constant per struct and needs no storage.
Fixes#450
This makes the new typed serialization the default (the old
serialization is not used but the code has not been cleaned up yet).
Some things are no working in the new world:
Chunking - The compound list is not working correctly any more. The
Chunks method is having issues because it assumed things based on the
old implicit chunking.
Commit - uses a `Set(Commit)` which means that the parent commit is
embedded. We need to change that to be `Set(Ref(Commit))` so that the
parent commit is referenced instead.
We'd wound up in a spot where serialization code used 'TypeRefKind' to
mean one of two very different things...either an actual value that
describes some Noms type, or a reference to a type definition that
lives somewhere else. To get rid of this ambiguity, we introduce
'UnresolvedKind' to take over the latter meaning. Now, TypeRefKind
means _only_ a value that describes a type. If you want to point off
to a type definition elsewhere in the type package, or in another
type package, use UnresolvedKind.