How to build an IO operations plugin?

I have built a libcouchbase wrapper for python which I am using in the Tornado framework. Tornado includes an ioloop for handling asynchronous events. For now I am calling lcb_wait() to complete libcouchbase operations, but I would like to start using it fully asynchronously, driven by the Tornado ioloop.

The blog post about driving libcouchbase with your own libevent event loop makes reference to creating a plugin:
libcouchbase performs it’s IO through an “IO handle”. This is a plugin system so you should be able to use whatever mechanism you want. Adding support for a new system is nothing more than implementing a handfull of function calls and place them in a shared object.

I have not found any documentation for the plugin system. I’ve looked at the source for the libevent & libev plugins and I could perhaps figure it out from them, but I’d feel a lot more comfortable doing so with a little guidance. Is there anything written that I can work from?

There are several external implementations:

  1. example with libev

  2. ruby GVL-friendly implementation

  3. ruby eventmachine (should be similar to twisted)

  4. perl anyevent implementation

  5. node.js libuv implementation