Ref values use the TargetRef to get the internal implementation
RegisterFromValFunction and ToNomsValueFromTypeRef were only used by
ref values at this point so these were renamed and simplified to be
more specific for ref values
The generated code for typed structs now uses a Go struct which
implements Value directly. The fields in this struct uses the "user"
type. (The union value still uses types.Value though.)
When a typed struct is created by the decoder, it asks for a struct
builder which returns a channel that the values of the fields of the
struct are sent to.
We now do a recursive call which bottoms out with a ref.Ref for RefKind
Values. This means that we traverse into nested structures consistently.
The effect of this is that we get all the refs that the current chunk
references.
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
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
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.
grammar.peg didn't get updated along with grammar.peg.go in arv's last patch,
so that needed to be fixed. Also, pkg.Parsed had its own field named Types, which
shadowed the one it got by embedded types.Package. This only came into play when
generating code for packages pulled out of a dataset. Since arv had to manually
patch up all generated code in his last patch, he never hit this issue and I
missed it in review.
Now, go generate passes once more. Yay
Replace datastore head with a map of datasetID's to commits. Each commit in the map represents that dataset's head. Fixes#402. Fixes#60. Filed #404 about small window of potential conflict with updating root that needs to be resolved at some point. # Please enter the commit message for your changes. Lines starting
The new serialization format use "t " as in typed. The rest of the
message is a JSON array describing the typed data. The type is
described by types.TypeRef
Fixes#384
Issues #281, #304
The TypeRef function for a Noms Struct should be the (Name, PkgRef) and
not the description of the struct fields. This is important because
when serializing we need to write the package ref.
Towards #281#304
Also, switch to using a ref.Ref when getting/setting the package
ref in a TypeRef. Using a types.Ref just led to lots of manual
boxing and unboxing every time I wanted to use the reference.
Toward issue #294
This patch mostly merges parse.Package and types.Package, though it
can't quite go all the way. A types.Package doesn't have 'using'
declarations, while the parsed representation of a .noms file needs to
have that information. Hence, the parse package is moved to the 'pkg'
package, and pkg.Parsed is introduced. This type embeds types.Package
and adds the necessary additional information.
To make inroads on handling imports, I enhanced ParsePackage() (now
called ParseNomDL()) to actually process the 'alias' and 'import'
statements in the input and go replace namespaced type names in the
package with refs of imported packages. For example, the TypeRef for
'Bar' generated in the following package
alias Foo = import "sha1-ffffffff"
struct Bar {
f: Foo.RockinStruct
}
will actually return types.Ref{sha1-ffffffff} when you call PackageRef()
on it.
In addition, I've added a function to the new 'pkg' package,
which allows the caller to get the dependencies of a type package
from a chunk store.
Fixes issue #353, towards issue #294
These were two representations of, essentially, the same information.
They were separate because they provided different APIs to similar
information, but the APIs became more similar once we started using
native types (as opposed to Noms types) for the various Make*TypeRef()
functions.
Unifying these is a big step to unifying parse.Package and types.Package,
which is pretty necessary for dealing with imported packages.
Fixes issue #338