Commit Graph

20 Commits

Author SHA1 Message Date
Dan Willhite 46586ee928 Remove msg args from d.PanicIfTrue and d.PanicIfFalse. (#2757)
Should discourage people from writing code that does unnecessary work
to generate a msg every time that an error condition is checked. Fixes #2741
2016-11-03 11:43:57 -07:00
zcstarr 40b28f94e5 Refactor Chunks and ChildValues API to work iteratively (#2599)
* Refactors Chunks and ChildValues API to be iterative change also
exposes WalkValues which replaces SomeP and AllP
2016-09-30 16:53:00 -07:00
cmasone-attic 2e462b11a5 Make Database a mutable API that vends immutable Datasets (#2617)
Noms SDK users frequently shoot themselves in the foot because they're
holding onto an "old" Database object. That is, they have a Database
tucked away in some internal state, they call Commit() on it, and
don't replace the object in their internal state with the new Database
returned from Commit.

This PR changes the Database and Dataset Go API to be in line with the
proposal in Issue #2589. JS follows in a separate patch.
2016-09-26 12:18:14 -07:00
Eric Halpern 27cbfdd489 Fix noms-sync surprising quantity (#2531)
* Use sampling for a better bytes-written estimate for noms sync
* Confirmed that remaining overestimate of data written is consistent with leveldb stats and opened #2567 to track
2016-09-20 10:57:40 -07:00
cmasone-attic 96cc9ffb1c Add FindCommonAncestor for Commits (#2579)
Once we integrate noms-merge into the `noms commit` command, this
function will allow us to stop requiring users to pass in the common
ancestor to be used when merging. The code can just find it and merge
away.

Toward #2535
2016-09-15 16:00:52 -07:00
Erik Arvidsson 5edf89cf3d Replace d.Chk.True with d.PanicIfFalse (#2563)
And same for d.Chk.False
2016-09-14 13:11:28 -07:00
cmasone-attic 65edbaabe3 Allow Dataset HEAD to be set to non-fastforward commits (#2271)
The Dataset.Commit() code pathway still enforces fast-forward-only
behavior, but a new SetHead() method allows the HEAD of a Dataset to
be forced to any other Commit.

noms sync detects the case where the source Commit is not a descendent
of the provided sink Dataset's HEAD and uses the new API to force the
sink to the desired new Commit, printing out the now-abandoned old
HEAD.

Fixes #2240
2016-08-05 15:38:41 -07:00
Rafael Weinstein 1c1d1920bf Make Pull step down one level at a time, de-dup source DB work queue (#2226)
It turns out Pull() was making some bad assumptions about how the Go
heap package used its backing storage. Since it wasn't really relying
on heap guarantees anyway, this changes the code to use a slice of Ref
that's sorted in order of increasing ref-height: RefByHeight.
2016-08-01 11:28:29 -07:00
cmasone-attic 7bd42b9502 Merge pull request #2089 from cmasone-attic/newissue1915
Add validation to BatchStore used by LocalDatabase
2016-07-19 15:26:54 -07:00
Chris Masone 143b27d833 Add validation to BatchStore used by LocalDatabase ONLY during Pull()
LocalDatabase generally uses a BatchStoreAdaptor, which is a kinda
dumb wrapper around ChunkStore. During a Pull(), though, this would
cause Chunks to be Put in a top-down fashion, meaning that Chunks
wound up in the backing store _before_ other Chunks that they
reference.  This means that LocalDatabases were transiently invalid,
and that cancelling an in-progress pull could lead to an invalid DB.

Now, calling validatingBatchStore() on a LocalDatabase returns a
BatchStore that uses the same strategy as RemoteDatabaseClient,
caching chunks as the come in and putting them into the backing store
bottom-up when Flush() is called.

Fixes #1915
2016-07-18 15:48:31 -07:00
Erik Arvidsson e2f261b142 Go: Compute commit type based on value and parents
We now compute the commit type based on the type of the value and
the type of the parents.

For the first commit we get:

```
struct Commit {
  parents: Set<Ref<Cycle<0>>>,
  value: T,
}
```

As long as we continue to commit values with type T that type stays
the same.

When we later commits a value of type U we get:

```
struct Commit {
  parents: Set<Ref<struct Commit {
    parents: Set<Ref<Cycle<0>>>,
    value: T | U
  }>>,
  value: U,
}
```

The new type gets combined as a union type for the value of the inner
commit struct.

Fixes #1495
2016-07-18 14:28:56 -07:00
Rafael Weinstein f752d1bfba Fix burnDown ordering issue (#1997) 2016-07-08 15:14:12 -07:00
Ben Kalman f57353ea89 Include MB and MB/s in sync progress (#1980) 2016-07-06 16:26:13 -07:00
Ben Kalman 53b9ce3c1e Add pull chunk progress to noms sync (#1950) 2016-07-06 15:01:32 -07:00
Aaron Boodman 1d752e3101 Update license: Noms will be copyright Attic Labs. (#1976) 2016-07-05 22:07:42 -07:00
Rafael Weinstein c47cc21d56 Remove more assertions which allocate in non-failure cases (#1942) 2016-07-01 10:09:59 -07:00
cmasone-attic 3b23ee12e7 Additional parallelism in pull.go (#1829)
In discussing the patch that added parallelism, raf and I realized
that it's possible to be a bit more aggressive in the cases where one
queue is 'taller' than the other. In the current code, in that case,
we will parallelize work on all the Refs from the taller queue that
have a strictly higher ref-height than the head of the shorter queue.
We realized that it's safe to also take Refs from the taller queue
that are the SAME height as those at the top of the shorter queue,
as long as you handle common Refs correctly.

Fixes #1818
2016-06-16 08:11:17 -07:00
Chris Masone e5bab88631 Add concurrency to noms-sync
The basic approach here is to take the max of the heights of the
source and sink queues, then grab all the refs of that height from
both and sort them into three sets: refs in the source, refs in the
sink, and refs in both. These are then processed in parallel and the
reachable refs are all added to the appropriate queue. Repeat as long
as stuff still shows up in the source queue.

Fixes #1564
2016-06-14 16:05:30 -07:00
cmasone-attic 74a0c98d75 Go: Use unified ref-height-based Pull algorithm (#1722)
Change Dataset.Pull to use a single algorithm to pull data from a
source to a sink, regardless of which (if any) is local. The basic
algorithm is described in the first section of pulling.md. This
implementation is equivalent but phrased a bit differently. The
algorithm actually used is described in the second section of
pulling.md

The main changes:
- datas.Pull(), which implements the new pulling algorithm
- RefHeap, a priority queue that sorts types.Ref by ref-height and
  then by ref.TargetHash()
- Add has() to both Database implementations. Cache has() checks.
- Switch Dataset to use new datas.Pull(). Currently not concurrent.

Toward #1568


Mostly, prune reachableChunks
2016-06-08 08:57:48 -07:00
Aaron Boodman bb7ac52265 Move the Go SDK into noms/go 2016-06-05 02:14:49 -07:00