Commit Graph

234 Commits

Author SHA1 Message Date
Chris Masone 2e68c39b14 Fix xml_importer and pitchmap/index to correctly use typed containers.
Fixes #554
2015-11-05 12:08:22 -08:00
Erik Arvidsson 460841e3ed Clean up registration of Ref values
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
2015-11-05 14:32:45 -05:00
Chris Masone 7b55efa9b6 Generated Code 2015-11-05 08:42:22 -08:00
Chris Masone d66151b4c1 Add IterAllP() to all typed Lists and Sets
Also added IterAllP() to types.Set so it could be used by generated
set code.

Towards #564
2015-11-05 08:42:22 -08:00
Erik Arvidsson 9ba1c4a508 Remove InternalImplementation() from List, Map & Set
Instead register a function to extract the internal backing store.
2015-11-04 18:57:36 -05:00
Erik Arvidsson 8c98964fee Generated code 2015-11-04 18:57:27 -05:00
Erik Arvidsson 7d4e2df45d Add types.Enum
This is needed to be able to round trip enums.

If there is no codegen for an enum that is read from the datastore we
now return a types.Enum which can be serialized back to the same
sequence.
2015-11-04 16:40:07 -05:00
Erik Arvidsson 5f66001324 Make sure that we call fixupTypeRef before we use the Ref
The Ref of a TypeRef is used in a maps and then it is important that
we fix all empty refs to point at the current package.

Remove unneeded calls to fixupTypeRef and make sure we call it just
before using the TypeRef as a key in a map.
2015-11-04 15:18:13 -05:00
Erik Arvidsson 07414d0a9e Remove InternalImplementation from structs
By adding a reader to structs we can remove the function that exposes
the internal implementation details of a struct.
2015-11-04 14:57:52 -05:00
Erik Arvidsson 756b893e8f Remove FromVal functions
The generated objects are all type.Values now so FromVal is not needed
2015-11-04 12:13:55 -05:00
Erik Arvidsson a45ba9df29 Followup minor cleanup
cmasone pointed this out but I missed it before merging.
2015-11-04 12:02:17 -05:00
Erik Arvidsson 9aadd85004 Add types.Struct and improve typed structs
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.
2015-11-04 11:55:07 -05:00
Erik Arvidsson eeaac87d5f Make Chunks return all reachable Refs from the current Value
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.
2015-11-03 17:13:20 -05:00
Aaron Boodman c65a776241 Remove compoundObjectToRef from compoundObject 2015-11-02 14:10:03 -08:00
Aaron Boodman 0622c8c860 Remove Future 2015-11-02 13:44:47 -08:00
Aaron Boodman bad6be3037 Remove futureFromValue. Another step toward removing Future. 2015-11-02 13:44:17 -08:00
Aaron Boodman c5b8de8174 Collapse list.go and list_leaf.go since we only have one impl. 2015-11-02 13:20:38 -08:00
Erik Arvidsson 89734aae9e Add runtime type assertions for the basic compound types
If we have a List, Map, Set or Ref with a non Value element type we
now check the type of the params to functions that "mutate" these.
2015-11-02 11:57:49 -05:00
Erik Arvidsson 62fad2d615 Merge pull request #536 from arv/equals-by-ref
Make Equals compare by Ref (after comparing TypeRef)
2015-10-30 18:35:08 -04:00
Aaron Boodman 894e615696 Merge pull request #535 from aboodman/blob-future
Convert NewBlob() away from using resolvedFutures
2015-10-30 15:05:09 -07:00
Erik Arvidsson 3c0ef5bcbb Make primitives reasonable 2015-10-30 17:33:47 -04:00
Erik Arvidsson 30cc7d518f Make Equals compare by Ref (after comparing TypeRef)
This changes equal to compare by ref. Since computing the ref can be
expensive we first check that the type refs are equal.

Fixes #532
2015-10-30 16:50:49 -04:00
Aaron Boodman c52bf0bbf5 Convert NewBlob() away from using resolvedFutures
Instead, use a backing MemoryStore. This is part of removing Futures.
2015-10-30 12:50:56 -07:00
Dan Willhite 80be862fda Regroup common code. 2015-10-30 10:36:34 -07:00
Dan Willhite 42bac09422 Make sfcrime/quad_tree apps work with new nomsdl types.
Change generated files to <base>.noms.go
2015-10-30 10:23:15 -07:00
Aaron Boodman a9bc416a2f Change Chunks() to return []ref.Ref 2015-10-30 09:24:58 -07:00
Erik Arvidsson 25e145c7fd Merge pull request #524 from arv/set-type-ref
Make Set TypeRef per instance
2015-10-30 09:49:19 -04:00
Erik Arvidsson 448edf2eb7 Merge pull request #523 from arv/map-type-ref
Make Map TypeRef per instance
2015-10-30 09:49:09 -04:00
Erik Arvidsson f0b8ec112e Merge pull request #522 from arv/ref-type-ref
Make types.Ref TypeRef per instance
2015-10-30 09:48:58 -04:00
Erik Arvidsson cf8cdbd55a Make Set TypeRef per instance
This is so that we can use type.Set for "unknown" set types when
decoding chunks.
2015-10-29 18:32:36 -04:00
Erik Arvidsson 66fd0881c7 Make Map TypeRef per instance
This is so that we can use type.Map for "unknown" map types when
decoding chunks.
2015-10-29 18:13:44 -04:00
Erik Arvidsson 9452b2c9a7 Make types.Ref TypeRef per instance
This is so that we can use type.Ref for "unknown" ref types when
decoding chunks.
2015-10-29 17:47:35 -04:00
Erik Arvidsson c87f18b039 Make List TypeRef per instance
This is so that we can use type.List for "unknown" list types when
decoding chunks.
2015-10-29 17:11:36 -04:00
Erik Arvidsson 67f06a38b5 Get rid of future from List
There were a few remnants of Future in list
2015-10-29 16:54:15 -04:00
Erik Arvidsson 8112c774f4 Remove types/walk.go
It is no longer used and it is not working in the new world where
containers are not implicitly out of line.
2015-10-29 12:56:46 -04:00
Erik Arvidsson 3aa7597788 Merge pull request #516 from arv/map-no-future
Remove future from Map
2015-10-29 12:30:49 -04:00
Erik Arvidsson ba85881fa3 Remove future from Map
The mapEntry is now using Values instead of Futures
2015-10-29 12:23:19 -04:00
Erik Arvidsson 48f53f33f8 Remove future from Set
The set now uses a []Value as its data. Still sorted by the ref.Ref
2015-10-29 12:05:36 -04:00
Rafael Weinstein 0e0be1c59b Remove trailing newline from json encoding in typed serialization 2015-10-28 17:07:34 -07:00
Dan Willhite 84b99fbc37 Check in generated files with new names and delete old ones. 2015-10-28 14:28:20 -07:00
Erik Arvidsson d7ac77571c Remove the enc package
Move the remaining files to types/
2015-10-28 12:38:30 -04:00
Erik Arvidsson c5fe67371d Remove old encoder/decoder
This removes the "j " encoding
2015-10-27 18:02:04 -04:00
Erik Arvidsson 378d60f48a Merge pull request #486 from arv/compound-blob-typed
NomDL: Encode compound blobs as structs
2015-10-27 17:55:57 -04:00
Erik Arvidsson 81f80d5ce6 NomDL: Encode compound blobs as structs
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
2015-10-27 17:53:16 -04:00
Erik Arvidsson e4544a4e49 NomDL: Remove extra write of the Package type refs
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.
2015-10-27 16:05:04 -04:00
Erik Arvidsson 8f7661e873 NomDL: Read Package from ChunkSource when decoding
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.
2015-10-27 09:49:59 -04:00
Erik Arvidsson cb233b0f68 Make sure we write packages to the store
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.
2015-10-26 19:21:47 -04:00
Erik Arvidsson cdcf952270 Update TypeRef comment and get rid of useless param
The name param of MakeCompoundTypeRef is always the empty string.

I didn't change the underlying storage or serialization.

Fixes #436, #477
2015-10-26 15:35:45 -04:00
Erik Arvidsson 1d13a878c4 Fix types.Ref and RefKind objects
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
2015-10-26 11:18:02 -04:00
Erik Arvidsson d9a93a4751 Remove compound list 2015-10-26 09:57:53 -04:00