dotcloud/docker — pull request #5706 by vieux (2014-05-09 18:26:40+00:00)
Title: remove addString and replace Tail in the engine

This PR removes `job.AddString`, `job.AddTail` and add a `Tail` method to the engine.

As mentioned in #5485 `AddString` leaks a goroutine and was overly complicated, it used multiple goroutines + scanner + ring + lock to get just one line.

`AddTail` worked the same way, so I guess it's leaking and wasn't used.

The replacement is to `job.Stdout.Add` a buffer and the call `engine.Tail(buffer, 1)` to get the last line.
(The scanner was already using a buffer, so it's not worse regarding the space, and there is no more locks/goroutines) Tail reads the buffer backwards, so it's faster than the scanner.

Close #5485