Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Submits a request to the server. // // Parameter msg: The request message. // // Parameter ctx: A context.Context. Use context.Background() if unsure! // // If resp is not-nil, you should call resp.Release() after you are done. Request(msg Message, ctx context.Context) (resp *Response, err error) }
type Request ¶
type Request struct { Msg Message // contains filtered or unexported fields }
A Request, a server can respond to.
func (*Request) Release ¶
func (r *Request) Release()
This method should be called after the request has been processed (both successfully or unsuccessfully).
func (*Request) Reply ¶
Replies with a message. Reply() calls m.SetSeq() with the correct sequence number.
Returns true if the message has been pushed to the Stream.Out queue, false otherwise.
func (*Request) ReplyDefault ¶
func (r *Request) ReplyDefault()
This method works like Reply(), except, that it calls Stream.DefaultResponse to generate the Message.
This is useful, if the server does not know, how to respond. This is the case with request-forwarding applications.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func (*Response) Get ¶
Retrieves the Message, waiting if necessary.
The returned message is subject to recycling using a memory pool provided by the *Stream structure.
If you want to retain it beyond .Release() you must call .RetainMsg().
type Stream ¶
type Stream struct { Err error Die <-chan struct{} In <-chan Message Out chan<- Message // memory management InRelease func(m Message) // release messages, received through s.In // Support for canceling requests. Cancel func() Message // generate a cancel-message. IsCancel func(m Message) bool // detect a cancel-message. DefaultResponse func() Message // Generate default response message. }