mirror of
https://github.com/docker/docs.git
synced 2026-11-05 00:14:17 +03:00
* Callback pattern that is easier to grok: each message has an optional nested return channel, instead of 2 nested streams * Return channel is in the Message structure: less arguments and return values to pass around * Caller can request a pipe as return channel, or pass its own. This makes proxying and advanced plumbing operations much easier. Signed-off-by: Solomon Hykes <solomon@docker.com>
18 lines
285 B
Go
18 lines
285 B
Go
package utils
|
|
|
|
import (
|
|
"github.com/docker/libswarm/beam"
|
|
)
|
|
|
|
type Buffer []*beam.Message
|
|
|
|
func (buf *Buffer) Send(msg *beam.Message) (beam.Receiver, error) {
|
|
(*buf) = append(*buf, msg)
|
|
return beam.NopReceiver{}, nil
|
|
}
|
|
|
|
func (buf *Buffer) Close() error {
|
|
(*buf) = nil
|
|
return nil
|
|
}
|