Commit Graph

33 Commits

Author SHA1 Message Date
Rafael Weinstein
45e5dc6260 tree walks now operate over types.RefBase 2016-04-13 15:26:44 -07:00
Rafael Weinstein
1676707906 WriteValue returns RefBase 2016-04-11 17:09:25 -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
Chris Masone
119a56c3a9 Move ReadValue and WriteValue to DataStore
This patch is the first step in moving all reading and writing to the
DataStore API, so that we can validate data commited to Noms.

The big change here is that types.ReadValue() no longer exists and is
replaced with a ReadValue() method on DataStore. A similar
WriteValue() method deprecates types.WriteValue(), but fully removing
that is left for a later patch. Since a lot of code in the types
package needs to read and write values, but cannot import the datas
package without creating an import cycle, the types package exports
ValueReader and ValueWriter interfaces, which DataStore implements.
Thus, a DataStore can be passed to anything in the types package which
needs to read or write values (e.g. a collection constructor or
typed-ref)

Relatedly, this patch also introduces the DataSink interface, so that
some public-facing apis no longer need to provide a ChunkSink.

Towards #654
2016-03-17 12:57:44 -07:00
Aaron Boodman
befeac553d Merge pull request #981 from aboodman/vendor-aws
Vendor using 'vendor' directory instead of Godeps
2016-02-09 09:46:38 -08:00
Aaron Boodman
cff0de3696 non-vendor changes 2016-02-08 23:15:09 -08:00
Chris Masone
83372d9596 Added newMetaTuple(), fixed new test 2016-02-08 13:47:21 -08:00
Rafael Weinstein
6c3239a1d0 Collections no longer need a ChunkStore on creation 2016-02-02 13:39:26 -08:00
Erik Arvidsson
61f14f8c9a Rename noms UInt* to Uint*
Fixes #673
2015-12-02 12:01:42 -05:00
Dan Willhite
afc3944341 Add top-down sync strategy. 2015-12-01 12:39:42 -08:00
Rafael Weinstein
7caa08bc5c Complex Types embed a ChunkStore 2015-12-01 10:40:47 -08:00
Rafael Weinstein
b499e6349a Use Skip* prefix, rather than commenting out disabled tests 2015-11-16 14:48:08 -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
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
Aaron Boodman
a9bc416a2f Change Chunks() to return []ref.Ref 2015-10-30 09:24:58 -07: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
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
Rafael Weinstein
8d56b8c968 Reland: ChunkSource.Get() now returns a []byte. chunks.Serialize takes a stream of Chunks 2015-09-17 12:31:25 -07:00
Rafael Weinstein
a62cf1bbb8 Revert "ChunkSouce.Get() now returns []byte"
This reverts commit 2be269acf4.
2015-09-16 20:47:36 -07:00
Rafael Weinstein
2be269acf4 ChunkSouce.Get() now returns []byte 2015-09-16 16:42:36 -07:00
Rafael Weinstein
068d4d3878 CopyChunksP 2015-09-16 10:50:19 -07:00
Dan Willhite
ab34143ba5 Pin dependencies using godep tool. Rewrite dep urls. 2015-08-26 14:05:40 -07:00
Aaron Boodman
b3bf30daa6 Rewrite DataSet to compose DataStore rather than embed it 2015-08-24 12:03:25 -07: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
82ff8b9cd1 Re-enable 'WalkTestSuite' in walk_test.go
I accidentally left this commented out at some point, and it rusted
a bit when I made the change to have walk.doTreeWalk() walk over
chunks rather than values. So, re-enable the tests and fix them.
2015-07-28 10:14:39 -07:00
Chris Masone
5375081821 Address aa comments
1) Change GetReachabilitySetDiff() to Difference()
2) make doTreeWalk() call cb() before it goes ahead and reads a value
2015-07-24 15:51:05 -07:00
Chris Masone
0ba565fed6 Add walk package
The walk package contains walk.Some() and walk.All() which let you
walk the Chunk graph starting at a given Ref.

I also added GetReachabilitySetDiff(), which will determine which
refs in a given ChunkSource can be reached from one given ref, but not
the other.

Towards issue #82
2015-07-23 16:47:39 -07:00
Chris Masone
d12dde500d Revert Walk() and GetReachabilitySetDiff()
It turns out these functions aren't actually generally useful,
because they deal in Values and Refs, while what we actually
want is to deal in chunks. So...

Revert "Settle big/small vs to/from ONCE AND FOR ALL"

This reverts commit f51c575cd2.

Revert "Add a naive Diff() function between two Values."

This reverts commit 662bc5e3c4.
2015-07-23 11:49:55 -07:00
Chris Masone
f51c575cd2 Settle big/small vs to/from ONCE AND FOR ALL 2015-07-22 14:35:36 -07:00
Chris Masone
662bc5e3c4 Add a naive Diff() function between two Values.
Given two refs, we need to be able to determine the set of chunks
reachable from one that cannot be reached from the other. This patch
adds a naive implementation of this functionality that essentially walks
the value tree down from the values pointed to by two refs and compares them.

It also has a little command-line driver, but this may be removed.

Fixes issue #82
2015-07-22 14:35:36 -07:00