Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandQueueName ¶
func RandQueueName() string
RandQueueName returns a random string to use as a queue name. Used for testing in a few places
Types ¶
type Client ¶
type Client struct { ID string Queues []string Conn ClientConn NotifyCh chan string }
Client represents a single okq client, either one just submitting events or a consumer. It expects to be handled in a single threaded context, except for methods marked otherwise (specifically Notify and DrainNotifyCh)
func NewClient ¶
func NewClient(conn ClientConn) *Client
NewClient creates a new Client structure around the given ClientConn
func (*Client) DrainNotifyCh ¶
func (client *Client) DrainNotifyCh()
DrainNotifyCh removes any queue notifications that may be buffered in the client. This may be called from another thread besides the one which "owns" the client
type ClientConn ¶
type ClientConn interface { io.ReadWriteCloser RemoteAddr() net.Addr }
ClientConn is obstensibly a net.Conn, but for testing we don't want to have to set up a real listen socket and all that noise
type FakeClientConn ¶
FakeClientConn implements ClientConn, but isn't an actual network connection. Can still be passed into resp.ReadMessage and other things that take in io.Readers and io.Writers. Used for testing here and other places
func NewFakeClientConn ¶
func NewFakeClientConn() *FakeClientConn
NewFakeClientConn initializes a FakeClientConn and returns it
func (*FakeClientConn) Close ¶
func (fconn *FakeClientConn) Close() error
Close does nothing and always returns nil. It is only here to implement the ClientConn interface
func (*FakeClientConn) RemoteAddr ¶
func (fconn *FakeClientConn) RemoteAddr() net.Addr
RemoteAddr always returns nil. It is only here to implement the ClientConn interface