Use a transaction when creating an artifact.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Merge pull request #29 from archSeer/artifact-transaction

Use a transaction when creating an artifact.
Add app deletion

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Merge pull request #25 from archSeer/app-deletion

App deletion
gofmt whitespace tweaks

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Merge pull request #31 from flynn/gofmt-whitespace-tweaks

gofmt whitespace tweaks
Generate config per job in the scheduler

We were getting intermittent errors in the scheduler tests:

FAIL: scheduler_test.go:173: S.TestWatchFormations

scheduler_test.go:242:
    c.Assert(jobCount, Equals, u.jobCount()+1)
    ... obtained int = 3
    ... expected int = 2

The issue was that when multiple jobs of a given type were started as
part of a single formation update, they all got stored in the
FakeCluster as the same struct because they all used the same config,
so modifying config.ID when starting each job was affecting jobs already
added to the Fake Cluster.

This then meant that removing jobs would either not remove any jobs
because the given ID did not match the ID which all the jobs had (i.e.
the last ID which config.ID was set to), or it would remove all the jobs
because they all had the given ID.

Generating the config per job fixes this.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Merge pull request #32 from flynn/generate-config-per-job

Generate config per job in the scheduler
Update the scheduler to reconnect to the controller

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Set updated_at when removing a formation

This is so that it will appear as an update when Subscribing to
formation events since a particular time

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Drop comment from scheduler

Since we track the last update seen from the controller and request all
updates after that when reconnecting, there is no need to sync with the
cluster when reconnecting.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Merge pull request #33 from flynn/scheduler-reconnects

Scheduler reconnects
Simplify artifact uniqueness

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Merge pull request #30 from archSeer/artifact-uniqueness

Simplify artifact uniqueness
Close client after scheduler disconnect

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Merge pull request #34 from flynn/close-client-after-scheduler-disconnect

Close client after scheduler disconnect
Bump Godeps

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
Merge pull request #35 from flynn/bump-godeps

Bump Godeps
Publish watchHost as started after it has called StreamEvents

This fixes a race where the tests believe watchHost is ready to stream
events so send it some events, but in fact the watchHost goroutine has
not yet called StreamEvents, so the event from the tests goes nowhere,
and watchHost just hangs once it actually starts waiting for events.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Merge pull request #37 from flynn/fix-watch-host-race

Publish watchHost as started after it has called StreamEvents