host,pkg,controller: Get rid of AddJobsRes & AddJobsReq

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host: Add support for streaming for listJobs and getJob.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host: Remove redundant parameter in RegisterHost.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host/sampi/http.go

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg/cluster/host.go

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host: Register Sampi routes.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg: cluster, fixed typos and returns

Signed-off-by: Corey Powell <mistdragon100@gmail.com>
controller, host, pkg: ListHosts returns an Array of host.Host

Signed-off-by: Corey Powell <mistdragon100@gmail.com>
bootstrap, controller, pkg, test: Standardize event channels

Signed-off-by: Corey Powell <mistdragon100@gmail.com>
bootstrap, controller, pkg, test: all Client methods should return an error
host: And then http fixes had to happen...

Signed-off-by: Corey Powell <mistdragon100@gmail.com>
host: Share the same port for attach and host API.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host: Share the same port with the Sampi API as well.

Sampi functions simply get mounted on the current leader.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host: Fix stopping RegisterHost.

When the connection terminates, Sampi needs to be notified, and close the stream
and unregister the host. We could probably further simplify the code if we
merged registerHost and RegisterHost.

We might consider sending a keep-alive heartbeat signal, or some other way of
ensuring the host is still up, as I do not know how reliable CloseNotifier is.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host: Fix StreamHostEvents.

Closing the channel emits an event by itself, we don't need to send a value.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
host, pkg/cluster: Get rid of NewClientWithID.

Was used for RPC to get around some bugs, and we don't use selfID anywhere in
the code anymore.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg/cluster: Update RemoveJob signature.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg/sse: Properly handle multi-line writes.

Each line needs to be prefixed with "data: " and terminated with a single
newline.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg/sse: Support multiline reads and returning server errors.

`event: error` will be treated as an error string returned from the server, and
returned as the error value from the function, wrapped into a sse.Error.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg/cluster: Support receiving server errors on stream clients.

We still need to send them from the server side.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>