oneway
Thrift 関数定義の 1 つで修飾子を使用しています。
...
oneway void secret_function(1: string x, 2: string y),
...
Thrift を介してそれぞれの Erlang コードを生成すると、これは次のように変換されます。
...
function_info('secret_function', reply_type) ->
oneway_void;
function_info('secret_function', exceptions) ->
{struct, []};
...
oneway_void
そこのアトムに注目してください。
関数が実行されると、secret_function
次のエラーが発生します。
=ERROR REPORT==== 2-Sep-2010::18:17:08 ===
oneway void secret_function threw error which must be ignored: {error,
function_clause,
[{thrift_protocol,
term_to_typeid,
[oneway_void]},
{thrift_protocol,
struct_write_loop,
3},
{thrift_protocol,
write,2},
{thrift_processor,
send_reply,
4},
{thrift_processor,
handle_function,
2},
{thrift_processor,
loop,1}]}
ユーザー コードに含まれる可能性のあるバグとは別に、ここではthrift_protocol:term_to_typeid/1
関数がアトムを引数として呼び出されoneway_void
、関数句が発生します。実際、コード (thrift_protocol.erl) から読み取ると、次のようになります。
...
term_to_typeid(void) -> ?tType_VOID;
term_to_typeid(bool) -> ?tType_BOOL;
term_to_typeid(byte) -> ?tType_BYTE;
term_to_typeid(double) -> ?tType_DOUBLE;
term_to_typeid(i16) -> ?tType_I16;
term_to_typeid(i32) -> ?tType_I32;
term_to_typeid(i64) -> ?tType_I64;
term_to_typeid(string) -> ?tType_STRING;
term_to_typeid({struct, _}) -> ?tType_STRUCT;
term_to_typeid({map, _, _}) -> ?tType_MAP;
term_to_typeid({set, _}) -> ?tType_SET;
term_to_typeid({list, _}) -> ?tType_LIST.
...
バグ?他の説明はありますか?なぜoneway_void
その関数に渡されているのですか?