[db][akumuli] Write client
at15 opened this issue · 1 comments
at15 commented
- https://github.com/akumuli/Akumuli/wiki/Writing-data-using-the-TCP-API
- https://hub.docker.com/r/akumuli/akumuli/
Akumuli doesn't send anything back in response to your writes if everything is OK. But if anything goes wrong it will send error message to client. Client can read data from socket (but not obliged) asynchronously to receive error messages. Error messages are RESP-encoded and will start with '-'.
TODO
- check write success by read ...
at15 commented
although we won't check response in current implementation ... some redis client in go could be a reference, after write, wait for replies from server (though I don't know if akumuli only return error when there is one or success message is also returned ...)
https://github.com/go-redis/redis/blob/master/redis.go#L134-L170
func (c *baseClient) defaultProcess(cmd Cmder) error {
for attempt := 0; attempt <= c.opt.MaxRetries; attempt++ {
if attempt > 0 {
time.Sleep(c.retryBackoff(attempt))
}
cn, _, err := c.getConn()
if err != nil {
cmd.setErr(err)
if internal.IsRetryableError(err, true) {
continue
}
return err
}
cn.SetWriteTimeout(c.opt.WriteTimeout)
if err := writeCmd(cn, cmd); err != nil {
c.releaseConn(cn, err)
cmd.setErr(err)
if internal.IsRetryableError(err, true) {
continue
}
return err
}
cn.SetReadTimeout(c.cmdTimeout(cmd))
err = cmd.readReply(cn)
c.releaseConn(cn, err)
if err != nil && internal.IsRetryableError(err, cmd.readTimeout() == nil) {
continue
}
return err
}
return cmd.Err()
}
````