libchan: github.com/docker/libchan Index | Files | Directories

package libchan

import "github.com/docker/libchan"

Index

Package Files

copy.go inmem.go libchan.go

Variables

var (
    // ErrIncompatibleSender is used when an object cannot support
    // SendTo for its given argument.
    ErrIncompatibleSender = errors.New("incompatible sender")
    // ErrIncompatibleReceiver is used when an object cannot support
    // ReceiveFrom for its given argument.
    ErrIncompatibleReceiver = errors.New("incompatible receiver")
)

func BufferedPipe Uses

func BufferedPipe(n int) (Receiver, Sender)

BufferedPipe returns an inmemory buffered pipe.

func Copy Uses

func Copy(w Sender, r Receiver) (int, error)

Copy copies from a receiver to a sender until an EOF is received. The number of copies made is returned along with any error that may have halted copying prior to an EOF.

func Pipe Uses

func Pipe() (Receiver, Sender)

Pipe returns an inmemory Sender/Receiver pair.

type Receiver Uses

type Receiver interface {
    // Receive receives a message sent across the channel from
    // a sender on the other side of the underlying transport.
    // Receive is expected to receive the same object that was
    // sent by the Sender, any differences between the
    // receive and send type should be handled carefully.  It is
    // up to the application to determine type compatibility, if
    // the receive object is incompatible, Receiver will
    // throw an error.
    Receive(message interface{}) error
}

Receiver is a channel which can receive messages of any content including other channels and bytestreams.

type ReceiverFrom Uses

type ReceiverFrom interface {
    // ReceiveFrom receives object from the given receiver. If the given
    // receiver is not a supported type, this function should return
    // ErrIncompatibleReceiver.
    ReceiveFrom(Receiver) (int, error)
}

ReceiverFrom defines a type which can directly receive objects from a receiver.

type Sender Uses

type Sender interface {
    // Send sends a message across the channel to a receiver on the
    // other side of the underlying transport.
    Send(message interface{}) error

    // Close closes the channel.
    Close() error
}

Sender is a channel which sent messages of any content including other channels and bytestreams.

type SenderTo Uses

type SenderTo interface {
    // SendTo sends object to the given sender. If the given
    // sender is not a supported type, this function should return
    // ErrIncompatibleSender.
    SendTo(Sender) (int, error)
}

SenderTo defines a type which can directly send objects from a sender.

type Transport Uses

type Transport interface {
    // NewSendChannel creates and returns a new send channel.  The receive
    // end will get picked up on the remote end of the transport through
    // the remote calling WaitReceiveChannel.
    NewSendChannel() (Sender, error)

    // WaitReceiveChannel waits for a new channel be created by the
    // remote end of the transport calling NewSendChannel.
    WaitReceiveChannel() (Receiver, error)
}

Transport represents a connection which can multiplex channels and bytestreams.

Directories

PathSynopsis
examples/rexec
examples/rexec/rexec_server
spdy

Package libchan imports 4 packages (graph) and is imported by 35 packages. Updated 2019-12-31. Refresh now. Tools for package owners.