Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
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") )
Functions ¶
func BufferedPipe ¶
BufferedPipe returns an inmemory buffered pipe.
Types ¶
type Receiver ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.