Commit Graph

222 Commits

Author SHA1 Message Date
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
Erik Arvidsson 6c7864edbe Change List to not use futures
This disables the compound list creation and its related tests
2015-10-26 09:34:54 -04:00
Erik Arvidsson e365b25dc4 Revert "Test travis ci GitHub integration" 2015-10-23 17:10:04 -04:00
Erik Arvidsson 40a3cda40b Test travis ci GitHub integration 2015-10-23 16:59:53 -04:00
Erik Arvidsson 91e7ffb8e1 NomDL Codegen: Parameterize the types package
This allows us to use the codegen from types/ without manual touchups
2015-10-23 11:04:30 -04:00
Chris Masone 1486d84487 Make generated Enum types implement types.Value
Fixes #391
2015-10-22 09:56:26 -07:00
Erik Arvidsson d668d05801 WriteValue minor fix 2015-10-22 12:36:15 -04:00
Erik Arvidsson 8c4bc79fcd NomDL: Remove $type from struct impl
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
2015-10-22 12:33:39 -04:00
Erik Arvidsson 3a5bb571fb NomDL: Remove NomsValue() 2015-10-22 10:47:14 -04:00
Erik Arvidsson 16353f38f8 NomDL: Make the new serialization default
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.
2015-10-21 19:04:22 -04:00
Dan Willhite bb2f983446 Add IsEmpty() function on ref.Ref.
Fixes #337.
2015-10-21 12:07:34 -07:00
Erik Arvidsson c217ffc74a NomDL Serialization: Need to handle Name and Namespace
MakeUnresolvedTypeRef has a Name and a Namespace and we should
serialize these too or we break Ref equality
2015-10-20 15:24:33 -04:00
Erik Arvidsson d6869cef35 NomDL: Make Package a primitive type
This solves the bootstrapping problems we are encountering.

Previously Package was a Struct but structs depend on Package.
2015-10-20 10:26:00 -04:00