From: Pete Zaitcev <zaitcev@redhat.com>
To: Colin McCabe <cmccabe@alumni.cmu.edu>
Cc: Jeff Garzik <jeff@garzik.org>,
Project Hail List <hail-devel@vger.kernel.org>
Subject: Re: the evils of the CLD api
Date: Sat, 16 Jan 2010 22:55:38 -0700 [thread overview]
Message-ID: <20100116225538.69ab2d36@redhat.com> (raw)
In-Reply-To: <436f52801001161754i3b60c17bt74ca735e0894e5f9@mail.gmail.com>
On Sat, 16 Jan 2010 17:54:36 -0800
Colin McCabe <cmccabe@alumni.cmu.edu> wrote:
> On Sat, Jan 16, 2010 at 3:21 PM, Pete Zaitcev <zaitcev@redhat.com> wrote:
> >> Shouldn't ncld_unlock and ncld_close return an error code rather than
> >> just eating all errors? The server certainly does sometimes send back
> >> error responses for these requests.
> >
> > This is an old bone of contention. The problem is, suppose the
> > application is cleaning up for exit. What is it supposed to do with
> > the error code? It cannot even retry sanely.
>
> If it's important enough for you to print out an error (*not* debug)
> message in the library, it should be important enough to pass along to
> the library user.
>
> After all, not everyone might be using a command-line app. Some people
> might want to see the error reflected in a dialog box, etc.
I'm going to try and explain again why the tear-down calls must not return
operation errors (they are free to return programmatic errors). This is
an important point for API design.
Suppose for a moment that ncld_end_sess returns an error. What is your
application going to do about it?
You seem to be suggesting to pop a dialog. But what is in the dialog
for the user? What can a user do? The answer is: a) retry, b) resign
to the loss of data and terminate the application forcefuly in the OS.
Or, actually, first (a) and then (b). And for the (b) to work above OS
you'll have a forceful tead-down method anyway (or rely on OS).
What's more, some applications do not have a way to interact with a
human (e.g. tabled). And this is where you got the logics completely
wrong. When I pointed that requirements of such applications dictate
a call that unconditionally ends the life of a structure or handle,
you (correctly) pointed out that interactive applications exist too.
But what of it?! The API must satisfy both kinds!
The correct approach -- and only if you _really_ have no alternative
to have some data outstanding or have other server interaction on
close -- is to provide a separate "flush" method, which can fail.
Then, the retry dialogs or other methods (e.g. copying of data into
other handle) can be used sanely.
-- Pete
P.S. ncld does not have a flush method because its writes are synchronous.
And if we cannot contact a server to close a session, it does not matter.
So the whole discussion is moot really. Nonetheless I think it's important
to have it, in general sense.
next prev parent reply other threads:[~2010-01-17 5:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-16 2:40 the evils of the CLD api Colin McCabe
2010-01-16 6:53 ` Pete Zaitcev
2010-01-16 21:38 ` Colin McCabe
2010-01-16 23:21 ` Pete Zaitcev
2010-01-17 1:54 ` Colin McCabe
2010-01-17 5:55 ` Pete Zaitcev [this message]
2010-01-19 21:54 ` Pete Zaitcev
2010-01-18 21:58 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100116225538.69ab2d36@redhat.com \
--to=zaitcev@redhat.com \
--cc=cmccabe@alumni.cmu.edu \
--cc=hail-devel@vger.kernel.org \
--cc=jeff@garzik.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.