Hi all,
At this point I have an alpha quality Thrift C (glib) client implementation (THRIFT-582). The source can be found on github here: http://github.com/mlum/thrift.

Here's what's been implemented so far:
- some of the original code from c-bindings branch modernized, refactored, and integrated into thrift trunk
 - thrift binary protocol
 - buffered, framed, memory buffer, socket, server socket transports
- codegen for C adding a --gen c option, supporting most/all thrift types (I think only unions are missing) - hooks into autotools to support gcov (./configure --enable-coverage) and valgrind (make memcheck or make leakcheck) to show code coverage and memory checks - about 25 or so tests that generate, compile and test code from most of the .thrift files in the test/ directory - a test that calls all the services in ThriftTest.thrift from a generated C client to a generated C++ server. - tests using C code generated by DebugProtoTest.thrift and ThriftTest.thrift files and exchanging it with Python, Perl, C++, Erlang, and Java servers. this isn't checked in yet. - a Cassandra 0.6.2 client, tested against our production cluster. this code is not in the thrift code on github, only was built as a sort of unit test and proof of concept. - compilation and tests run on MacOS X 10.6 + MacPorts, CentOS 5.3, and MinGW in a Windows XP VM.

I tried to keep all the code as compartmentalized as possible, only adding lib/c and test/c directories, a t_c_generator.cc file, and then the modifications to the autotools and other thrift files to do some checks and include the C implementation. It should pretty much apply cleanly to the current thrift trunk.

There's still a lot of work to do, one of the most important of which is to get test code coverage up to 100%, and then get those tests running through valgrind with no memory leaks. There are likely a few leaks in there now triggered by error conditions. Also, I need to generate the thrift server code as well for service implementations. The core serialization and transports should be there already though.

Anyways, work will continue on this out of a desire to have a pure C Cassandra client and a pure C Thrift implementation that works within the Thrift codegen framework. In the meantime, a couple questions:

- should I attach this stuff to THRIFT-582 as a massive patch? not sure how well that would work, as there will still be a lot of future updates. I'm happy to just continue to work on github, or use something else if there are suggestions. - GLib doesn't provide something that maps directly to Thrift Sets. I used GHashTable to fake it, setting the key and the value to the set member. I could subclass GHashTable and create something called TSet or THashSet (or GSet or GHashSet?), or I could just continue with GHashTable. Any thoughts?

Finally, if someone wants to try it out, feedback, patches, and pull requests are certainly welcome.

Mike




Reply via email to