Simon South created THRIFT-2709: ----------------------------------- Summary: c_glib: Support server implementation Key: THRIFT-2709 URL: https://issues.apache.org/jira/browse/THRIFT-2709 Project: Thrift Issue Type: Improvement Components: C glib - Compiler, C glib - Library Affects Versions: 0.9.1 Environment: Fedora 20 64-bit on x86_64 Reporter: Simon South Priority: Minor
The attached patches modify the C (GLib) compiler and library to add support for implementing servers. The changes to the compiler include * Adding server-generation methods ** {{generate_service_helpers}}, which generates a pair of {{ThriftStruct}} subclasses for each service method, used to deserialize the method's arguments and serialize its result ** {{generate_service_handler}}, which generates an abstract base class for a service's handler implementations ** {{generate_service_processor}}, which generates a service's processor class * Adding helper methods {{underscores_to_initial_caps}} and {{property_type_name}} which, respectively, convert an underscore-delimited name back to camel case and return the GLib type needed to store a Thrift type as a GObject property Changes to the library include * Changing the signature of {{ThriftProcessor.process}} so it returns I/O errors to its caller * Adding the {{ThriftDispatchProcessor}} class, ported from the C++ implementation, which subclasses {{ThriftProcessor}} and parses an incoming method-call message for dispatch by subclasses * Adding a {{peek}} method to {{ThriftTransport}} and corresponding implementations in {{ThriftSocket}}, {{ThriftBufferedTransport}} and {{ThriftFramedTransport}} * Add {{ThriftBufferedTransportFactory}} and {{ThriftFramedTransportFactory}}, used by the server to wrap a raw {{ThriftTransport}} in the corresponding subtype * Changing the signature of {{ThriftServer.server}} so it returns an error status to its caller, following [GLib's conventions|https://developer.gnome.org/glib/2.26/glib-Error-Reporting.html#glib-Error-Reporting.description] * Changing {{ThriftSimpleServer.serve}} so it ** Detects and reports errors encountered during processing ** Uses transports returned by the transport factories instead of the (raw) transport passed in by the caller ** Uses {{ThriftTransport.peek}} to detect the end of input ** Returns an error status to its caller -- This message was sent by Atlassian JIRA (v6.3.4#6332)