beam: Router can route beam messages with a convenient set of rules and handlers
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
parent
992a3f9c96
commit
36231f23a3
4 changed files with 246 additions and 6 deletions
11
beam/beam.go
11
beam/beam.go
|
@ -1,6 +1,7 @@
|
|||
package beam
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
@ -100,3 +101,13 @@ func Copy(dst Sender, src Receiver) (int, error) {
|
|||
panic("impossibru!")
|
||||
return n, nil
|
||||
}
|
||||
|
||||
// MsgDesc returns a human readable description of a beam message, usually
|
||||
// for debugging purposes.
|
||||
func MsgDesc(payload []byte, attachment *os.File) string {
|
||||
var filedesc string = "<nil>"
|
||||
if attachment != nil {
|
||||
filedesc = fmt.Sprintf("%d", attachment.Fd())
|
||||
}
|
||||
return fmt.Sprintf("'%s'[%s]", payload, filedesc)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue