add thrift and example code