Commit Graph

46 Commits

Author SHA1 Message Date
Erik Arvidsson 1edbee5f34 Remove Set Subtract 2015-12-17 15:23:28 -05:00
Erik Arvidsson b8be6908f8 Implement Set Union
This is done by creating a cursor for each set. This is a cursor for
the actual values in the sets. We then pick the "smallest" value from
the cursors and advance that cursor. This continues until we have
exhausted all the cursors.

  setA.Union(set0, ... setN)

The time complexity is O(len(setA) + len(set0)) + ... len(setN))
2015-12-17 10:18:04 -05:00
Rafael Weinstein 27d5f0d240 Ensure sequenceChunker.Done() returns an internal type so that callers dont have to 2015-12-17 06:20:28 -08:00
Rafael Weinstein d198036618 Compound Map & Set 2015-12-08 16:25:02 -08: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
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 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 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 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 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 0622c8c860 Remove Future 2015-11-02 13:44:47 -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 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 a9bc416a2f Change Chunks() to return []ref.Ref 2015-10-30 09:24:58 -07: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 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
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 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
Erik Arvidsson 8565f175ee Make sure Chunks includes type.Refs and the TypeRef
Chunks shold return the futures for types.Ref values.

For typed values that have a TypeRef which has a package ref, also
include that.
2015-10-13 11:00:51 -04:00
Erik Arvidsson ede5f43204 Value should also have a TypeRef
This is so that we can get the runtime type of a value
2015-09-30 16:15:13 -04:00
Erik Arvidsson 1a4bdae624 Make types.Ref explicit
No more implicit Get or Equals
2015-09-18 14:03:19 -04:00
Erik Arvidsson 175cc7ccc1 NomDL: Codegen for Set extras
This adds Iter, IterAll and Filter to Sets

Issue #303
2015-09-17 16:49:22 -04:00
Rafael Weinstein 0555d7a3c1 Remove errors from read/write/encode/decode 2015-08-18 16:37:04 -07:00
Aaron Boodman 214b37eccf Remove global imports of dbg package
Fixes #179
2015-08-08 23:57:37 -07:00
Aaron Boodman 7944c1b3af Revert "Make WriteValue return a "skinny" copy of input value" 2015-07-30 09:23:35 -07:00
Aaron Boodman a84893c0d8 Make WriteValue return a "skinny" copy of input value
Fixes #141
2015-07-29 16:06:54 -07:00
Chris Masone 4fe00d4f81 Address aa's comments
- Return factory methods to privacy
- use tighter syntax inside Chunks() methods
- Rename Futures() -> Chunks()
2015-07-23 15:32:38 -07:00
Chris Masone a560139d73 Make types.future public
This will enable us to walk the chunk graph without having to go
through weird contortions to figure out which values don't have
chunks in any chunkstore (because they were inlined).

Towards issue #82
2015-07-23 15:32:26 -07:00
Erik Arvidsson 3fdc008f5c Codegen: Add support for noms types
This makes it possible to do a List of Bool or Map of Int32 etc
2015-07-22 12:24:27 -07:00
Aaron Boodman 81b9c27193 Fix duplicate set inserts 2015-07-21 13:43:58 -07:00
Aaron Boodman 409fd1b076 Map and Set: Compare using future.Val() when possible.
This can be more efficient than comparing by ref for primitives.
2015-07-21 09:26:38 -07:00
Aaron Boodman 5ae553db81 Set: Optimize adding multiple values at once. 2015-07-20 16:03:05 -07:00
Aaron Boodman 636708e302 Switch Set from using a Map to a sorted set internally. 2015-07-20 09:28:53 -07:00
Rafael Weinstein 50029d1380 Removing cachedRef inferior of func ensureRef() 2015-07-10 16:16:13 -07:00
Aaron Boodman daac3ef87f Incremental loading for sets.
Issue #11
2015-07-10 13:29:21 -07:00
Aaron Boodman 96f21c4a60 Remove the Foo/flatFoo abstraction in the types package.
Fixes #24.
2015-07-10 11:29:03 -07:00
Aaron Boodman e6f1f0147d Add test for Set::Any() 2015-07-01 22:56:29 -07:00
Aaron Boodman 8590bd4249 Finish first crack at generating strong Go types for noms data 2015-06-26 16:35:08 -07:00
Aaron Boodman 7412338434 Add user package an function to create an empty user set 2015-06-17 17:21:34 -07:00
Aaron Boodman 7cda3c280f Add Set::Union() and Set::Subtract() 2015-06-16 11:07:55 -07:00
Aaron Boodman 129798c006 Support any type of Value for keys of maps 2015-06-15 15:57:33 -07:00
Aaron Boodman 08a53bb48f add types.Set 2015-06-13 23:25:48 -07:00