All of lore.kernel.org
 help / color / mirror / Atom feed
* the evils of the CLD api
@ 2010-01-16  2:40 Colin McCabe
  2010-01-16  6:53 ` Pete Zaitcev
  2010-01-18 21:58 ` Jeff Garzik
  0 siblings, 2 replies; 8+ messages in thread
From: Colin McCabe @ 2010-01-16  2:40 UTC (permalink / raw)
  To: Pete Zaitcev, Jeff Garzik, Project Hail List

Hi all,

I saw Pete's post about "the evils of event-driven programming in CLD clients."

I tend to agree with him that the current API can be frustrating to think about.
I had a few thoughts about what might be a better API:

1) when starting the cld session, the user code could register a
"vtable" containing a bunch of different callbacks.
That way all GET responses for the session could flow through
my_get_response(), and so on.

This at least would give the API user a single place to look when
trying to find out how some CLD event is handled.

Right now, we have callbacks installing other callbacks, which makes
things hard to follow, IMHO.

2) provide a blocking API that users could take advantage of.
I think for a lot of simple programs, programmers would be happy to
spawn a thread per CLD session. In fact, I'm not aware of any programs
that want to spawn a lot of cld sessions (maybe someone can point out
one.)

Most of the CLD uses that I've seen have been things like "find out
who the master node is." For that kind of use, it seems unlikely that
you would open too many sessions. In an era of multi-core processors
and NPTL, spawning a dedicated thread to find the master is kind of a
big yawn.

I think a non-blocking API, in some form, should probably be
available, though, in case people need it. We may not be able to
anticipate all the uses that CLD is put to.

Anyway... those are just my thoughts right now...

Colin

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-01-19 21:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-01-19 21:54     ` Pete Zaitcev
2010-01-18 21:58 ` Jeff Garzik

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.