Commit Graph

155 Commits

Author SHA1 Message Date
Dan Willhite
32bb498339 Replace Commit type with types.Struct().
Remove last vestiges of codegen in datas. Fixes #1296.
2016-04-25 10:24:09 -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
Erik Arvidsson
5896559db7 Remove support for enums (#1291) 2016-04-22 10:14:05 -07:00
Erik Arvidsson
bbeb504943 Type describe use human readable serialization (#1287)
* Make Type Describe use the Human Readable Serialization

This reduces code duplication.

* Remove Choices in favor of []Field
2016-04-21 11:12:37 -07:00
Dan Willhite
6db8f5def1 Merge pull request #1284 from willhite/datas
Remove codegen artifacts from types.
2016-04-21 10:03:47 -07:00
Dan Willhite
bb7f039e69 Remove codegen artifacts from types. 2016-04-20 17:41:09 -07:00
Erik Arvidsson
0d5b6c4223 Remove Go codegen (#1285) 2016-04-20 16:59:43 -07:00
Dan Willhite
9300a81df6 Remove nomsdl info from datas. 2016-04-20 15:42:39 -07:00
Chris Masone
6ff58aa38b Report backpressure over the wire
Using ChunkStore.PutMany() means that the DataStore server code
can detect when the ChunkStore it's writing to can't handle
the amount of data being pushed. This patch reports that
status back across the wire to the client that's attempting
to write a Value graph. Due to Issue #1259, the only thing the
client can currently do is retry the entire batch, but we hope
to do better in the future.
2016-04-19 11:27:45 -07:00
Marina Moore
42b468e591 added flags library 2016-04-19 09:42:54 -07:00
Marina Moore
2ac56f9821 changed read-data for new method of making remote datastore 2016-04-15 14:41:10 -07:00
Chris Masone
c1e1fb97bb Remove now-unneeded PrivateRefFromType
Fixes #1209.

Also, clean up a few comments.
2016-04-15 13:36:46 -07:00
Chris Masone
0fc183d429 Refactor new DataStore code
The initial refactor had some pretty confusing struct and method
names, so this patch renames a number of things and migrates a bunch
of code to the types/ from datas/, where it seems to be a better
logical fit.

datas.cachingValueStore          -> types.ValueStore
datas.hintedChunkStore interface -> types.BatchStore
datas.naiveHintedChunkSink       -> types.BatchStoreAdaptor
datas.httpHintedChunkStore       -> datas.httpBatchStore
datas.notAHintedChunkSink        -> datas.notABatchStore

Also, types now exports a ValidatingBatchingSink, which is used by
datas.HandleWriteValue to process incoming hints and validate incoming
Chunks before putting them into a ChunkStore.

Towards Issue #1250
2016-04-15 10:57:45 -07:00
Erik Arvidsson
c91b8146dc Go: Eagerly fixup types after the Package has been created (#1241)
This fixes the package refs in NewPackage and makes the serializer
know about these refs when a Package is encoded.
2016-04-13 18:09:22 -07:00
Rafael Weinstein
45e5dc6260 tree walks now operate over types.RefBase 2016-04-13 15:26:44 -07:00
Chris Masone
a8423c9234 Special-case Package chunks when caching reachables during ReadValue
For performance reasons, Package objects for generated Noms Types are
side-loaded when reading Values. This means that the
opportunistically-populated chunk->Type map used by DataStore when
validating writes won't see these chunks in a number of cases. This
can lead to false negatives and erroneous validation failures. This
patch special-cases RefOfPackage when caching the Chunks reachable
from a newly-read Value, manually fetching them from the
types.PackageRegistry and crawling their reachable Chunks.

Fixes #1229.
2016-04-13 15:08:18 -07:00
Chris Masone
7db243745b httpHintedChunkStore uses one big batch
A novel chunk may contain references to any other novel chunk, as long
as there are no cycles. This means that breaking up the stream of
novel chunks being written to the server into batches risks creating
races -- chunks in one batch might reference chunks in another,
meaning that the server would somehow need to be able to
cross-reference batches. This seems super hard, so we've just forced
the code to write in one massive batch upon Commit(). We'll evaluate
the performance of this solution and see what we need to change.

Also, there's a terrible hack in HandleWriteValue to make it so that
pulls can work by back-channeling all their chunks via postRefs/ and
then writing the final Commit object via writeValue/
This can be fixed once we fix issue 822
2016-04-12 18:50:35 -07:00
Chris Masone
d8a2d285e9 Pull DataStore API over the wire and kill chunks.HTTPStore
This patch is unfortunately large, but it seemed necessary to make all
these changes at once to transition away from having an HTTP
ChunkStore that could allow for invalid state in the DB. Now, we have
a RemoteDataStoreClient that allows for reading and writing of Values,
and performs validation on the server side before persisting chunks.
The semantics of DataStore are that written values can be read back
out immediately, but are not guaranteed to be persistent until after
Commit() The semantics are now that Put() blocks until the Chunk is
persisted, and the new PutMany() can be used to write a number of
Chunks all at once.

From a command-line tool point of view, -h and -h-auth still work as
expected.
2016-04-12 14:08:58 -07:00
Rafael Weinstein
4006746b21 Remove Ref.SetTargetValue 2016-04-11 17:25:56 -07:00
Rafael Weinstein
1676707906 WriteValue returns RefBase 2016-04-11 17:09:25 -07:00
Chris Masone
1d857a4686 Refactor DataStore Copy methods into functions
This patch removes the special RemoteDataStore implementation of
CopyReachableChunksP, as this is seldom-used and adds complexity
that stands in the way of Issue 654
2016-04-04 15:23:43 -07:00
Chris Masone
44bb16385c Add DataStore 'Type' cache to remember Noms type info as well.
To facilitate validation, DataStore needs to remember which chunks
it's seen, what their refs are, and the Noms type of the Values they
encode. Then, DataStore can look at each Value that comes in via
WriteValue() and validate it by checking every embedded ref (if any)
against this cache.

Towards #654
2016-03-22 16:34:26 -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
c515b80c88 types.WriteValue -> types.EncodeValue 2016-03-18 13:53:04 -07: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
Chris Masone
6b4c93a3f7 Fix up DataStore comments
If I'm going to start refactoring this code, it's important
that I'm sure what all the methods do. So, update the comments
2016-03-09 12:45:45 -08:00
Chris Masone
8eb61455c2 Clean up DataStore interface comments 2016-02-25 17:05:04 -08:00
Chris Masone
ae618c52f9 Support Dataset delete
This is the most naive implementation of Dataset deletion. It does no
cleanup of data, but simply drops the Dataset's head from the map at
the root of the DataStore.
2016-02-11 10:51:59 -08: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
Ben Kalman
4d1a7529a1 Merge pull request #977 from kalman/http-auth
Support setting the "Authorization" header on http store requests.
2016-02-08 17:03:42 -08:00
Benjamin Kalman
25b0516651 Support setting the "Authorization" header on http store requests. 2016-02-08 16:41:37 -08:00
Chris Masone
8134433126 Add datas.NewTestFactory()
There was no way to create a datas.Factory from outside
the datas package except via datas.Flags. Also, this patch
moves the CreateFactory() method on Flags into the file
where all the rest of the Flags stuff is defined.
2016-02-08 16:15:01 -08:00
Rafael Weinstein
6c3239a1d0 Collections no longer need a ChunkStore on creation 2016-02-02 13:39:26 -08:00
Chris Masone
c2ced705cb Fix /ref/ endpoint
The issue was an ill-specified URL matcher. Now, there's an
appropriate one that captures the ref URL parameter and passes
it into HandleRef.
2016-02-02 08:59:10 -08:00
Chris Masone
507b881c21 Make named DataStores first-class citizens
In order to allow tools like shove to correctly address named
DataStores, we need to have the notion of a name be settable at the
DataStoreFlags level. Once we've done that, it doesn't really make
sense to have API surface for creating DataStores without a name --
though for compatibility, the code will continue to accept an empty
string for a DataStore's name
2016-02-01 10:50:54 -08:00
cmasone-attic
5550960964 Merge pull request #926 from cmasone-attic/issue917
Fix LevelDB support for named datastores
2016-01-29 13:00:54 -08:00
Chris Masone
7fc728f769 Fix LevelDB support for named datastores
We use a conceptually similar approach to the one we use with DynamoDB
to allow a single database to provide multiple named datastores: keys
are all namespaced using the name of the datastore. The implementation
is a bit different, as we need to run the backing database ourselves.

Fixes #917
2016-01-29 12:10:26 -08:00
Erik Arvidsson
8a8531a3a2 Fix legacy endpoints for datastore server
We were not handling /ref/sha1-123/ correctly
2016-01-28 14:05:52 -08:00
Chris Masone
1316d19462 Enable clients/server to address multiple DataStores
Add DataStore.Factory and ChunkStore.Factory so that client programs
that need to create multiple namespaced {Chunk,Data}Stores of the kind
indicated by command line flags have a convenient way to do so. The
details of how this is implemented are mostly contained in the various
ChunkStore.Factory implementations:

1) MemoryStore, TestStore - no change
2) LevelDBStore - the namespace is used as a subdirectory of the path
                  provided by the user
3) HTTPStore - the namespace is used as a path prefix for the endpoints
               supported by DataStoreServer
4) DynamoStore - the namespace is used as a prefix on all keys

This change also required that DataStoreServer be able to handle URLs
of the form "http://server:port/namespace/endpoint", e.g.
"http://localhost:8000/mydatastore/getRefs". It currently still handles
the non-namespaced endpoints as well.

In order to make code from DataStoreServer more re-usable in other
contexts, the functions that handle calls to the server's various
endpoints are now standalone and live in datas/handlers.go.
DataStoreServer just contains logic for dispatch and server lifetime
management.
2016-01-26 13:58:57 -08:00
Chris Masone
f191306146 Skip racy HTTPStoreTestSuite by default
Allow it to be re-enabled by setting RUN_HTTP_STORE_TEST
2016-01-25 16:33:48 -08:00
Rafael Weinstein
3fbf014f0c Lazily load root dataset map in Datastore to avoid being test-buzkill 2016-01-25 13:43:44 -08:00
Rafael Weinstein
7015fb2a47 Enable & fix remote_datastore_test 2016-01-24 20:12:51 -08:00
Erik Arvidsson
5282014bb2 Add a Dynamo DB Store
This DynamoDB store borrows some logic from HttpStore, in that Get,
Has and Put requests are dumped into channels that are watched by
code in goroutines and batched up to be sent to the backend.
A few structs have been factored out of http_store.go and moved to
remote_requests.go, where they are enhanced so that DynamoStore can use
them as well.
2016-01-14 12:19:14 -08: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
Rafael Weinstein
d198036618 Compound Map & Set 2015-12-08 16:25:02 -08:00
Dan Willhite
2018863432 Add hasCache to datastore.
Fixes #693.
2015-12-08 11:22:50 -08:00
Chris Masone
e035b1166d Fix import of goleveldb package to point into Godeps/_workspace
Need to keep our dependencies hermetic and pinned.
2015-12-03 10:21:07 -08:00