GObject-based streams redux



Hello,

I've stumbled upon another GLib-based project that reinvents
polymorphic I/O (namely, regular sockets and TLS) as several
others do (in particular, Gnome-VFS happens to have implemented
TLS too). This once again hints at a gaping hole in the
GTK/GNOME APIs: a truly extensible data stream framework
low on the dependency stack.
These mailing lists have seen a heated discussion on this
several months ago:

http://mail.gnome.org/archives/gnome-devel-list/2003-February/msg00029.html

Did the Wise Ones converge on some chunk of useful code, taking off
from that?

My own partially informed thoughts:

- It should be built around an abstract GObject-based stream class
  or classes, fully extensible.

- The base class(es) and essential subclasses, like OS files
and memory buffers, might end up in the glib trunk, but, of course,
not in the core glib.

- With regard to I/O interface design, there seems to be two camps.
Let me outline their perceived viewpoints, assigning them figurative
labels. 
    1) The COM approach: one coarse-grained stream interface that has
    read, write, truncate, size and seek (but little else).
    The implementations that don't need/support some of the methods
    just pop out errors.
    2) The Java/C++ approach: a hierarchy of interfaces that provide
    compile-time control over stream usage through multiple
    inheritance. As a good example, marvel at java.io and java.nio.
Personally, I'd prefer the first approach for the GObject-based I/O,
because extensive OO is clumsy in C.

- Asynchronous I/O: probably, a creation flag and/or stream attribute
  in the base stream class could be enough, provided the async support
  is not mandatory for implementations. Of course, read/write
  methods should support asynchronous semantic.

- On returning a "descriptor" to poll/wait on: GSource seems
  to be the solution.

- And yes, in the long term it should supersede GIOChannel.

-- 
Stay tuned,
  MhZ                                     JID: mhz altlinux org
___________
root rot



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]