Commit Graph

133 Commits

Author SHA1 Message Date
Aaron Boodman
2fbe923ee9 Remove unnecessary godep flag 2016-02-09 11:06:10 -08:00
Aaron Boodman
cff0de3696 non-vendor changes 2016-02-08 23:15:09 -08:00
Rafael Weinstein
6c3239a1d0 Collections no longer need a ChunkStore on creation 2016-02-02 13:39:26 -08:00
Erik Arvidsson
a44b2ff6e3 Merge pull request #883 from arv/codegen-ref-bug
Fix issue with canUseDef
2016-01-20 15:15:33 -08:00
Erik Arvidsson
c6ce02b285 Add codegen test too 2016-01-20 14:03:49 -08:00
Erik Arvidsson
4482eed74c Fix issue with canUseDef
We were not passing the package through when we called
containsComparable which made us lookup the type in the wrong package.

Fixes #869
2016-01-20 13:27:48 -08:00
Benjamin Kalman
833d581115 Add a -godep flag to codegen to can generate godep compatible code.
This specifies the name of the package using nomdl through godep, which
is applied as a prefix to github.com/attic-labs/noms imports.

For example, -godep=github.com/foo/bar generates imports to
"github.com/foo/bar/Godeps/_workspace/src/github.com/attic-labs/noms".
2016-01-19 11:40:26 -08:00
Benjamin Kalman
232492003d Lazily write sequence chunks.
Instead of writing sequence chunks as soon as they're are created (as a
result of hitting chunk boundaries), only write them once they're
referenced - which only happens if those chunks are themselves chunked.

The effect of this is root chunks of collections/blobs aren't written
until they're committed, which makes the XML importer run twice as fast
on a month of MLB data - 60s instead of 120s, with --ldb-dump-stats
showing a PutCount of 21,272 instead of 342,254.

In the future it should be possible to avoid writing *any* chunks until
the root is committed, which will improve incremental update
performance, but that's a larger change (issue #710). This change fixes
issue #832.
2016-01-05 15:57:45 +11:00
Erik Arvidsson
1edbee5f34 Remove Set Subtract 2015-12-17 15:23:28 -05:00
Benjamin Kalman
9a3e73779d Make types.Ref implement the OrderedValue interface.
This fixes the bug where compoundSets/Maps of refs are ordered by their
type.Ref's Ref, rather than their type.Ref's TargetRef.
2015-12-14 11:28:38 -08:00
Erik Arvidsson
40d164fe47 Go: Encode numbers as strings
Because JSON encoders encode numbers differently we cannot just use
numbers in the output.

This still encodes the NomsKind as numbers.

Towards #749
2015-12-11 16:30:07 -05:00
Rafael Weinstein
d198036618 Compound Map & Set 2015-12-08 16:25:02 -08:00
Dan Willhite
699cc2accc Fixes #687.
Make dataStoreCommon.doCommit() return an error instead of boolean.
2015-12-02 16:41:00 -08:00
Rafael Weinstein
e0b368302d listLeaf & compoundList implement List interface 2015-12-02 13:54:25 -08:00
Erik Arvidsson
698c21bc67 NomDL: Change type syntax to use <> instead of ()
Fixes #678
2015-12-02 12:30:00 -05:00
Erik Arvidsson
61f14f8c9a Rename noms UInt* to Uint*
Fixes #673
2015-12-02 12:01:42 -05:00
Erik Arvidsson
ff8924db09 NomDL codegen: Fix clobbering
If two files depend on the same file we ended up overwriting the
first written file which is problematic because the "internal" types
would not be written the second time.
2015-12-01 15:02:04 -05:00
Rafael Weinstein
7caa08bc5c Complex Types embed a ChunkStore 2015-12-01 10:40:47 -08:00
Rafael Weinstein
e75f5097c7 Allow Map & Set to order by natural ordering of element type if available. 2015-11-16 14:30:30 -08:00
Erik Arvidsson
a72ce41a1d Go: TypeRef -> Type
Remaining identifiers
2015-11-13 17:54:53 -05:00
Benjamin Kalman
efa52fed84 Implement a generic sequence chunker, and use it to create blobs. 2015-11-13 14:21:26 -08:00
Chris Masone
f0f49c6010 Generated Code 2015-11-09 08:35:06 -08:00
Chris Masone
eda9b92870 Rename types.TypeRef to types.Type
There are probably still a lot of variable names and comments to fix,
but this updates all the Go code.

Towards #441
2015-11-09 08:26:32 -08:00
Aaron Boodman
69a86f3036 Rewrite walk() to walk value tree instead of chunks
Also fix quad_tree to take advantage of that to be generic again.

Fixes #445, #497
2015-11-05 16:12:02 -08:00
Chris Masone
b54fd91c82 Add Filter() to List
And update collection templates to be backed by the untyped
Filter() implementations.

Fixes #578
2015-11-05 15:15:46 -08:00
Chris Masone
c40b57fc41 Generated code 2015-11-05 15:15:07 -08:00
cmasone-attic
7fad0856c3 Merge pull request #579 from cmasone-attic/issue564
IterAllP for typed Maps
2015-11-05 15:14:47 -08:00
Erik Arvidsson
cc89fb2d90 Remove the channel from struct reader/builder
Instead use a slice of Value
2015-11-05 16:34:03 -05:00
Erik Arvidsson
329e13e0ae Generated code 2015-11-05 16:33:25 -05:00
Chris Masone
5bda67180d Run go generate ./... at top level to pick up codegen changes from rebase 2015-11-05 12:15:23 -08:00
Chris Masone
4e79367d1a IterAllP for typed Maps
Fixes #564
2015-11-05 12:06:10 -08:00
Erik Arvidsson
2fcd3ce3af Merge pull request #575 from arv/register-ref
Clean up registration of Ref values
2015-11-05 14:51:37 -05:00
Erik Arvidsson
0fa249e5ff Create README.md 2015-11-05 14:51:25 -05: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
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
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
Chris Masone
d3162c9081 Fix botched handling of -in with -out-dir
The output file should always be emitted relative to -out-dir. I was
incorrectly appending the path to the input file onto that provided in
-out-dir to construct the path to the output file.
2015-11-02 14:14:43 -08:00
Chris Masone
a64cee5aab Clean up codegen -out-dir flag handling
Get rid of -out and ensure that Go package names generated from -out-dir
are actually legal Go identifiers.

Fixes #476
2015-11-02 12:17:42 -08: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