Commit Graph

32 Commits

Author SHA1 Message Date
Rafael Weinstein
d1e2aa01f3 Go: ref.Ref -> hash.Hash (#1583)
ref.Ref -> hash.Hash
2016-05-21 11:38:35 -07:00
Mike Gray
54e4c18806 primitives.go split into bool.go and number.go (#1503)
* primitives.go split into bool.go and number.go, interfaces implemented marked, a few .gitignore files updated
* removing old binary names
2016-05-13 19:13:19 -04:00
Erik Arvidsson
58464baef9 Total ordering of values (#1475)
This allows having a set/map of heterogenous elements/keys. To support
this we have to be able to have a total ordering for all noms values.

The ordering is false < true < -999 < 0 < 999 < "" < "a" < "z" < Hash
In other words, Bool < Number < String < * and for comparing non
primitives we compare the hash of the object.

Fixes #1104
Fixes #1312
2016-05-12 10:35:56 -07:00
Rafael Weinstein
24826ade3d Remove common noms file & RefBase 2016-04-25 11:20:01 -07:00
Erik Arvidsson
423d3a87ec Make MakeCompoundType package private (#1304)
And same for MakePrimitiveType. This also makes sure that we return
the same primitive type every single time.

Fixes #1271
2016-04-22 17:49:27 -07:00
Erik Arvidsson
02c47661fd Make all usages of Type in Go use pointers (#1295)
This is in preparation of allowing back references which requires
pointers to be able to compare that the structs are the same.
2016-04-22 15:19:42 -07:00
Chris Masone
82338bb5be Change Value.Chunks() to return []types.RefBase
In pursuit of issue #654, we want to be able to figure out all the
refs contained in a given Value, along with the Types of the Values to
which those refs point. Value.Chunks() _almost_ met those needs, but
it returned a slice of ref.Ref, which doesn't convey any type info.

To address this, this patch does two things:
1) RefBase embeds the Value interface, and
2) Chunks() now returns []types.RefBase

RefBase now provides Type() as well, by virtue of embedding Value, so
callers can just iterate through the slice returned from Chunks() and
gather type info for all the refs embedded in a given Value.

I went all the way and made RefBase a Value instead of just adding the
Type() method because both types.Ref and the generated Ref types are
actually all Values, and doing so allowed me to change the definition of
refBuilderFunc in package_registry.go to be more precise. It now returns
RefBase instead of just Value.
2016-03-21 16:13:14 -06: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
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
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
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
Aaron Boodman
a9bc416a2f Change Chunks() to return []ref.Ref 2015-10-30 09:24:58 -07: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
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
4e69837ef0 This introduce two new internal values, blobLeaf and compoundBlob. At
this point the compoundBlob only contains blob leafs but a future
change will create multiple tiers. Both these implement the new Blob
interface.

The splitting is done by using a rolling hash over the last 64 bytes,
when that hash ends with 13 consecutive ones we split the data.

Issue #17
2015-08-03 20:09:42 -04:00
Erik Arvidsson
c5964aadcd Make Blob take a Reader instead of byte array
This is in preparation for chunking
2015-07-30 18:53:22 -04: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
Rafael Weinstein
50029d1380 Removing cachedRef inferior of func ensureRef() 2015-07-10 16:16:13 -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
53003f23f2 Add Value::Ref() 2015-06-12 15:22:27 -07:00
Aaron Boodman
266a96a084 Factor Blob back out into a method of String, rather than embedded. Embedding makes branching on nom type hard. 2015-06-09 22:56:17 -07:00
Aaron Boodman
7d00f1bf12 Add initial String implementation 2015-06-04 14:42:28 -07:00