package beam
import "github.com/dotcloud/docker/pkg/beam"
Index ¶
- func Connect(ctx *UnixConn, name string) (net.Conn, error)
- func Copy(dst Sender, src Receiver) (int, error)
- func FdConn(fd int) (n *net.UnixConn, err error)
- func Listen(conn Sender, name string) (net.Listener, error)
- func MsgDesc(payload []byte, attachment *os.File) string
- func SendPipe(dst Sender, data []byte) (*os.File, error)
- func SocketPair() (a *os.File, b *os.File, err error)
- func USocketPair() (*UnixConn, *UnixConn, error)
- type ReceiveCloser
- type ReceiveSender
- type Receiver
- type Route
- func (r *Route) All() *Route
- func (r *Route) Filter(f func([]byte, *os.File) bool) *Route
- func (route *Route) Handle(payload []byte, attachment *os.File) error
- func (r *Route) Handler(h func([]byte, *os.File) error) *Route
- func (r *Route) HasAttachment() *Route
- func (r *Route) KeyEquals(k string, full ...string) *Route
- func (r *Route) KeyExists(k string) *Route
- func (r *Route) KeyIncludes(k, v string) *Route
- func (r *Route) KeyStartsWith(k string, beginning ...string) *Route
- func (route *Route) Match(payload []byte, attachment *os.File) bool
- func (r *Route) NoKey(k string) *Route
- func (r *Route) Passthrough(dst Sender) *Route
- func (route *Route) Tee(dst Sender) *Route
- type Router
- func NewRouter(sink Sender) *Router
- func (r *Router) NewRoute() *Route
- func (r *Router) Send(payload []byte, attachment *os.File) (err error)
- type SendCloser
- type Sender
- type UnixConn
Functions ¶
func Connect ¶
func Copy ¶
func FdConn ¶
FdConn wraps a file descriptor in a standard *net.UnixConn object, or returns an error if the file descriptor does not point to a unix socket. This creates a duplicate file descriptor. It's the caller's responsibility to close both.
func Listen ¶
Listen is a convenience interface for applications to create service endpoints which can be easily used with existing networking code.
Listen registers a new service endpoint on the beam connection `conn`, using the service name `name`. It returns a listener which can be used in the usual way. Calling Accept() on the listener will block until a new connection is available on the service endpoint. The endpoint is then returned as a regular net.Conn and can be used as a regular network connection.
Note that if the underlying file descriptor received in attachment is nil or does not point to a connection, that message will be skipped.
func MsgDesc ¶
MsgDesc returns a human readable description of a beam message, usually for debugging purposes.
func SendPipe ¶
func SocketPair ¶
SocketPair is a convenience wrapper around the socketpair(2) syscall. It returns a unix socket of type SOCK_STREAM in the form of 2 file descriptors not bound to the underlying filesystem. Messages sent on one end are received on the other, and vice-versa. It is the caller's responsibility to close both ends.
func USocketPair ¶
Types ¶
type ReceiveCloser ¶
type ReceiveSender ¶
func Devnull ¶
func Devnull() ReceiveSender
type Receiver ¶
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func (*Route) All ¶
func (*Route) Filter ¶
func (*Route) Handle ¶
func (*Route) Handler ¶
func (*Route) HasAttachment ¶
func (*Route) KeyEquals ¶
func (*Route) KeyExists ¶
func (*Route) KeyIncludes ¶
func (*Route) KeyStartsWith ¶
func (*Route) Match ¶
func (*Route) NoKey ¶
func (*Route) Passthrough ¶
func (*Route) Tee ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func (*Router) NewRoute ¶
func (*Router) Send ¶
type SendCloser ¶
type Sender ¶
type UnixConn ¶
func FileConn ¶
func ReceiveConn ¶
func SendConn ¶
func (*UnixConn) Receive ¶
Receive waits for a new message on conn, and receives its payload and attachment, or an error if any.
If more than 1 file descriptor is sent in the message, they are all closed except for the first, which is the attachment. It is legal for a message to have no attachment or an empty payload.
func (*UnixConn) Send ¶
Send sends a new message on conn with data and f as payload and attachment, respectively. On success, f is closed
Source Files ¶
beam.go router.go service.go unix.go
Directories ¶
Path | Synopsis |
---|---|
pkg/beam/data | |
pkg/beam/examples | |
pkg/beam/examples/beamsh |
- Version
- v0.11.1
- Published
- May 8, 2014
- Platform
- js/wasm
- Imports
- 7 packages
- Last checked
- 9 minutes ago –
Tools for package owners.