Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MaxWriteAttempts specifies amount of retries to write on failure MaxWriteAttempts = 3 // MessageBuffer specifies the size of buffer for incoming messages // If buffer is full, new messages will be dropped MessageBuffer = 8 )
View Source
var ( ErrClosed = errors.New("pipe: closed pipe") ErrReset = errors.New("pipe: reset pipe") )
View Source
var Protocol protocol.ID = "/pipe/1.0.0"
Functions ¶
func RemovePipeHandler ¶
func RemovePipeHandler(host core.Host, proto core.ProtocolID)
RemovePipeHandler removes pipe handler from host
func SetPipeHandler ¶
func SetPipeHandler(host core.Host, h Handler, proto core.ProtocolID)
SetPipeHandler sets new stream handler which wraps stream into the pipe
Types ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func NewRequest ¶
NewRequest creates new pipe Message. After sending it waits for response from remote end of pipe
type Pipe ¶
type Pipe interface {
// Closes pipe for writing
io.Closer
// Send puts message in the pipe which after are transported to other pipe's end
Send(*Message) error
// Next iteratively reads new messages from pipe
Next(context.Context) (*Message, error)
// Protocol returns protocol identifier defined in pipe
Protocol() protocol.ID
// Conn returns underlying connection used by pipe
Conn() network.Conn
// Reset closes the pipe for reading and writing on both sides
Reset() error
}
Click to show internal directories.
Click to hide internal directories.