Thrift 格式规范在哪里?

发布于 2024-10-17 07:48:53 字数 360 浏览 2 评论 0原文

尽管 Thrift 格式使用相对广泛(并且项目仍然存在),但我还没有找到底层数据格式的规范。或者格式,因为显然至少有两种格式;标准格式,紧凑格式。

鉴于它的广泛使用,我希望这只是我可怜的谷歌-fu,并且存在一个或多个规范(在源代码之外)。如果有,请分享!

编辑:Java 源代码对于确定格式来说还不错;参见 TBinaryProtocol.java 和 TCompactBinaryProtocol.java;其中包含由生成的类(扩展 TBase)调用的原语

EDIT2:虽然它不包含格式规范,但“缺少的指南”是很好的读物。

Although Thrift format is relatively widely used (and project still alive), I haven't been able to find specification for the underlying data format. Or formats, given that there are apparently at least two formats; standard one, and compact format.

Given its wide usage I am hoping it is just my poor google-fu, and a specification or specifications exist (outside of source code). If so, please share!

EDIT: Java source code is not too bad for figuring out format; see TBinaryProtocol.java and TCompactBinaryProtocol.java; which contain primitives, called by generated classes (which extend TBase)

EDIT2: While it does not contain format spec, "the missing guide" is good reading.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

半枫 2024-10-24 07:48:53

我遇到了同样的问题,因此决定编写 Thrift 二进制和紧凑协议的规范。

该规范现已在 Thrift 存储库中提供: https://github.com/ apache/thrift/tree/master/doc/specs

旧答案:

您可以在这里找到它:https://erikvanoosten.github.io/thrift-missing-specification/

I had the same problem and therefore decided to write a specification of the Thrift binary and compact protocol.

The spec is now available in the Thrift repo: https://github.com/apache/thrift/tree/master/doc/specs

Old answer:

You can find it here: https://erikvanoosten.github.io/thrift-missing-specification/

孤独患者 2024-10-24 07:48:53

Thrift 消息的格式取决于所选的序列化协议。您可以使用多种协议之一序列化 Thrift 对象,包括 TBinaryProtocol、TCompactProtocol、TJSONProtocol 和其他晦涩的选项。该协议在原始的 Thrift 白皮书 PDF 中进行了抽象描述: API,但目前尚未在 Thrift apache 项目中的任何地方定义。

TCompactProtocol 协议在 thrift wiki 上的定义稍好一些,但并不简单。

在提供更好的文档之前,您还可以将 Python 库代码与 Python struct 模块文档一起检查,作为另一种选择。

The format for a Thrift message depends on the serialization protocol chosen. You can serialize a Thrift object using one of many protocols, including the TBinaryProtocol, TCompactProtocol, TJSONProtocol, and other obscure options. The protocol is described abstractly in the original Thrift Whitepaper PDF in terms of the API, but is not currently defined anywhere in the Thrift apache project.

The TCompactProtocol protocol is slightly better defined on the thrift wiki but not in simple terms.

Until better documentation is available, you can also examine the Python library code alongside the Python struct module documentation as another option.

七秒鱼° 2024-10-24 07:48:53

有两种二进制编码:紧凑型和非紧凑型。

通常你会在野外找到紧凑的协议:

https://github.com /apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md

虽然非紧凑协议可能是遗留协议:

https://github.com /apache/thrift/blob/master/doc/specs/thrift-binary-protocol.md

这是该规范的粗略概述:

https://github.com /apache/thrift/blob/master/doc/specs/thrift-protocol-spec.md

There are two binary encodings, compact and and non-compact.

Usually you will find the compact protocol in the wild:

https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md

While the non-compact protocol is probably a legacy protocol:

https://github.com/apache/thrift/blob/master/doc/specs/thrift-binary-protocol.md

With this being a rough overview of the specification:

https://github.com/apache/thrift/blob/master/doc/specs/thrift-protocol-spec.md

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文