节俭:是否有可能只做序列化与C(GLib的)储蓄库? [英] Thrift: Is it possible to do only serialization with the C (GLib) Thrift library?

查看:149
本文介绍了节俭:是否有可能只做序列化与C(GLib的)储蓄库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用例如但它总是返回write_len = 10个字节。

  ThriftTransport *运输= THRIFT_TRANSPORT(
    g_object_new(THRIFT_TYPE_MEMORY_BUFFER,buf_size,8096,NULL));
ThriftProtocol *协议= THRIFT_PROTOCOL(
    g_object_new(THRIFT_TYPE_BINARY_PROTOCOL,运输,运输,
        空值));例外* SRC = g_object_new(TYPE_EXCEPTION,NULL);
ExceptionClass * CLS = EXCEPTION_GET_CLASS(SRC);
g_object_set(SRC,
    ex_sign,exception_signature,
    cl_sign,class_signature,
    中招,catch_method!= NULL,
    空值);INT write_len = THRIFT_STRUCT_C​​LASS(CLS) - GT;写(THRIFT_STRUCT(SRC),协议和放大器;错误);


解决方案

这是错误在C(GLib的)实现的报道和固定就在最近,所以你需要获取和建立的从混帐最新的节俭源,在例如正常工作。

如果你好奇,你可以看到<一个href=\"http://mail-archives.apache.org/mod_mbox/thrift-user/201511.mbox/%3C1448492604.6423%40zygmund.net%3E\"相对=nofollow>上的用户邮件列表导致错误被识别的讨论。

I am trying to use this example but it always return write_len = 10 bytes.

ThriftTransport* transport = THRIFT_TRANSPORT(
    g_object_new(THRIFT_TYPE_MEMORY_BUFFER, "buf_size", 8096, NULL));
ThriftProtocol* protocol = THRIFT_PROTOCOL(
    g_object_new(THRIFT_TYPE_BINARY_PROTOCOL, "transport", transport,
        NULL));

Exception* src = g_object_new(TYPE_EXCEPTION, NULL);
ExceptionClass* cls = EXCEPTION_GET_CLASS(src);
g_object_set(src,
    "ex_sign", exception_signature,
    "cl_sign", class_signature,
    "caught", catch_method != NULL,
    NULL);

int write_len = THRIFT_STRUCT_CLASS(cls)->write(THRIFT_STRUCT(src), protocol, &error);

解决方案

This was a bug in the C (GLib) implementation that was reported and fixed just recently, so you'll need to fetch and build the latest Thrift source from git for the example to work correctly.

If you're curious, you can see the discussion on the user mailing list that led to the bug being identified.

这篇关于节俭:是否有可能只做序列化与C(GLib的)储蓄库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆