[sheepdog] [PATCH v2 3/4] sheep: handle block/unblock/notify error

Kai Zhang kyle at zelin.io
Tue Jul 9 04:15:50 CEST 2013


On Jul 9, 2013, at 8:43 AM, MORITA Kazutaka <morita.kazutaka at gmail.com> wrote:

> I think block/unblock/notify should return SD_RES_xxx since they know
> the error reason rather than the callers.  Currently, all the
> callbacks only can return SD_RES_CLUSTER_ERROR or SD_RES_SUCCESS,
> though.


Here is my personal opinion.

I think SD_RES_xxx is used as return code to external module (other sheep and client)
to indicate the error of a request.
However, block/unblock/notify are internal functions who don't know they are serving for
external requests.
I think, we can indicate internal error by logging and only use return code '-1' when fail.
It is the caller's responsible (here the caller is queue_cluster_request) to mark the result
as SD_RES_xxx.

The drawback is that we cannot know the specific error from return code.
However, as an internal function, I think only use 0 and -1 as return code is enough.

Thanks,
Kyle

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20130709/7332f0cf/attachment-0004.html>


More information about the sheepdog mailing list