Compare commits

..

No commits in common. "8a3df95491f47b1f85d5e38b5f78f31e24ccec65" and "47645a8fce7a65b7c67a349f4640f2b27a94abb0" have entirely different histories.

View File

@ -28,31 +28,23 @@ type Conn interface {
SetSizeLimit(limit int64)
}
// Trans is a HOPP transaction. Methods of this interface are not safe for
// concurrent use with the exception of the Close and ID methods. The
// recommended use case is one goroutine per transaction.
// Trans is a HOPP transaction.
type Trans interface {
// Close closes the transaction. Any blocked operations will be
// unblocked and return errors. This method is safe for concurrent use.
// unblocked and return errors.
Close() error
// ID returns the transaction ID. This must not change, and it must be
// unique within the connection. This method is safe for concurrent use.
// unique within the connection.
ID() int64
// TODO: add methods for setting send and receive deadlines
// Send sends a message. This method is not safe for concurrent use.
// Send sends a message.
Send(method uint16, data []byte) error
// SendWriter sends data written to an [io.Writer]. Any writer
// previously opened through this function will be discarded. This
// method is not safe for concurrent use, and neither is its result.
SendWriter(method uint16) (io.Writer, error)
// Receive receives a message. This method is not safe for concurrent
// use.
// Receive receives a message.
Receive() (method uint16, data []byte, err error)
// ReceiveReader receives a message as an [io.Reader]. Any reader
// previously opened through this function will be discarded. This
// method is not safe for concurrent use, and neither is its result.
// previously opened through this function will be discarded.
ReceiveReader() (method uint16, data io.Reader, err error)
}