Exemple #1
0
func (c *Client) Ping(r *bufio.Reader) error {
	_, err := rpc.ReadString(r)
	if err != nil {
		return logex.Trace(err)
	}
	c.errChan <- nil
	return nil
}
Exemple #2
0
func (c *Client) Delete(r *bufio.Reader) error {
	topicName, err := rpc.ReadString(r)
	if err != nil {
		return logex.Trace(err)
	}
	c.que.Delete(topicName, c.errChan)
	return nil
}
Exemple #3
0
func (c *Client) Put(r *bufio.Reader) error {
	topicName, err := rpc.ReadString(r)
	if err != nil {
		return logex.Trace(err)
	}

	var header message.Header // move to client field?
	msgs, err := rpc.ReadMsgs(&header, r)
	if err != nil {
		return logex.Trace(err)
	}

	c.que.Put(topicName, msgs.Msgs(), c.putErrChan)
	return nil
}
Exemple #4
0
func (c *Client) Get(r *bufio.Reader) error {
	topicName, err := rpc.ReadString(r)
	if err != nil {
		return logex.Trace(err)
	}
	offset, err := rpc.ReadInt64(r)
	if err != nil {
		return logex.Trace(err)
	}
	size, err := rpc.ReadInt64(r)
	if err != nil {
		return logex.Trace(err)
	}

	c.get(topicName, offset.Int64(), size.Int())
	return nil
}