thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@bestweb.net
Subject cthrift with state-machine based receive
Date Fri, 02 Apr 2010 10:20:55 GMT

Sorry about the _LONG_ delay between releases of cthrift. I was working on
replacing the recursive deserializer with a state-machine based one. It's
now been implemented and tested to the same level as the recursive
version.

Why is this interesting? Well, the main loop looks like:
  while( have_not_finished_reading_message ) {
      process_next_arc_in_state_machine
  }
But it also lets us do the following:
  while( (status = process_next_arc(state)) != DONE ) {
     if( status == SOCKET_WOULD_HAVE_BLOCKED ) {
       save_state_and_do_something_else;
    }
    if( status == ERROR )
      use_state_to_handle_error;
   }
 }

So, we get the ability to handle part of a message, then switch to
handling another message, then come back to the message, etc.

As you might gather, this will be a nice platform for implementing
streaming messages as well.

Another thing, that is specific to the implementation. The state-machine
approach creates a data structure per type. So, its a _LOT_ less expensive
to compose types.




Mime
View raw message