四季春属于什么茶| 一起共勉是什么意思| 办理出院手续都需要什么| 什么治咳嗽最快最有效| 什么既什么又什么| 眉毛白了是什么原因引起的| 为什么姨妈会推迟| 前列腺钙化是什么意思| 乳腺4a是什么意思| 蛇舌草有什么功效| 号外是什么意思| 鲶鱼吃什么食物| 智齿是什么原因引起的| 勾股定理是什么意思| 梦见自己搬家是什么意思| 梦见已故的父母是什么兆头| 右下眼皮跳是什么预兆| 眩晕挂什么科| 稻谷是什么| l是什么码| 自强不息的息是什么意思| 为什么有蟑螂| 荷花象征着什么| 便民门诊是做什么的| 肚脐眼左边疼是什么原因| 秋天的落叶像什么| 小麦什么时候播种| 网贷是什么| 口爆什么意思| 肺型p波是什么意思| 火丹是什么原因造成的| 香港脚是什么| 来褐色分泌物是什么原因| 什么男什么女| 7月15日是什么日子| 亦或是什么意思| 小儿抽搐是什么原因引起的| 阴道口痒是什么原因| 脚趾甲变厚是什么原因| 扔枕头有什么忌讳吗| 珐琅是什么| 柠檬什么时候成熟| 葛根粉有什么功效和作用| 点痣后要注意什么| 隆胸有什么危害和后遗症吗| 周瑜是一个什么样的人| 血尿是什么原因| 肚子里有积水是什么病| 曲安奈德是什么药| 癫痫病是什么原因引起的| 脚麻是什么原因造成的| 性转是什么意思| honor是什么牌子手机| 知觉是什么意思| c919是什么意思| 一什么鱼| 感冒头晕是什么原因| 今年43岁属什么| 黄瓜片贴脸上有什么效果| 智商120是什么水平| 为什么家里有蚂蚁| 鲁迅是著名的什么家| 胆囊壁胆固醇结晶是什么意思| 肝郁脾虚吃什么药效果最好| 逗闷子是什么意思| 多彩的什么| 侍郎是什么官| 孕早期是什么时候| 二级医院是什么意思| 钾离子低的原因是什么| coa什么意思| 女孩子喜欢什么礼物| edifice是什么牌子手表| 梦见怀孕的女人是什么意思| peaches是什么意思| 智齿长什么样子| 闰月给父母买什么| 盗汗什么意思| 红楼梦为什么叫石头记| 中耳炎不能吃什么食物| 头孢什么样子图片| 乳痈是什么意思| 为什么说冬吃萝卜夏吃姜| 女人人中深代表什么| 减肥可以喝什么饮料| 烤冷面的面皮是什么面| 为什么会长闭口粉刺| 诺贝尔为什么没有数学奖| 南京区委书记什么级别| 哮喘什么症状| ct什么意思| 2000年出生属什么| 想请假找什么理由好| 阴道炎是什么引起的| c3是什么车型| 吃什么可以缓解孕吐恶心| 什么盛开| 副业做什么比较好| 灌肠用什么水| 早上起来手麻是什么原因| 大泽土是什么生肖| 惜字如金什么意思| 1901年是什么年| 蒸蒸日上什么意思| 缓释是什么意思| 得失是什么意思| 有机玻璃是什么| 眼睛为什么老是流眼泪| 胃酸想吐是什么原因| 排档是什么意思| 电邮地址是什么| 什么样的小手| 7月18日是什么日子| 潜力是什么意思| 宫缩疼是什么感觉| 谷氨酸是什么| 疖子是什么| pt是什么元素| 中伤是什么意思| 什么是良心| 淋巴炎吃什么药效果好| bmi是什么意思啊| 角质增生是什么意思| 胃黏膜受损是什么症状| 桃花什么颜色| 促甲状腺激素低是什么原因| 养肝要吃什么| 一喝酒就脸红是什么原因| 喉咙痛有痰吃什么药| 斑鸠是什么| 物有所值是什么意思| 女人30如狼40如虎是什么意思| 吃什么东西增强免疫力| 产妇吃什么下奶快又多又营养| 肾尿盐结晶是什么意思| 胸闷是什么原因造成的| 梦到自己生孩子了是什么预兆| 默契什么意思| 胃阳不足吃什么中成药| 儿童不长个子去医院挂什么科| 蝶窦囊肿是什么病| 六月初六是什么节| 令香是什么意思| 什么的眉毛| 手脚发热什么原因| 心电图t波改变是什么意思| 电脑为什么打不开| 湿热内蕴吃什么中成药| 肝郁症是什么病| 眼睛有血丝是什么原因| 什么一清二白| 7月4日什么星座| 冬瓜有什么功效和作用| 奢华是什么意思| 转基因和非转基因有什么区别| 最大的沙漠是什么| 老鼠属于什么类动物| 梦见自己开车是什么意思| 李宁是什么牌子| 吃李子不能吃什么| 微针是什么| 大便颗粒状是什么原因造成的| 胃炎吃什么药效果最好| 送荷花的寓意是什么| female是什么意思| 故是什么意思| 婴儿什么时候长牙| 母亲节可以做什么礼物| 蝶窦囊肿是什么病| 轻贱是什么意思| 泡妞是什么意思| 扁平疣是什么原因造成的| 尿里红细胞高什么原因| 狗与什么属相相冲| 新生儿什么时候可以喝水| pbs是什么| 阴毛有什么作用| 福报是什么| Ecmo医学上是什么意思| 晚上睡觉口干是什么原因| 二月一日是什么星座| 心跳和心率有什么区别| lh是什么意思啊| 尿酸高吃什么药效果好| 相声海清是什么意思| 伤口消毒用什么好| 吃六味地黄丸有什么好处| 鱼翅是什么鱼身上的| 脚腕肿是什么原因| 大保健是什么意思| 脚指麻木是什么病先兆| 甲泼尼龙是什么药| 心脏不舒服有什么症状| 年轻人创业做什么好| 心脏病吃什么食物好| 太虚幻境是什么意思| 又拉又吐吃什么药| 梅核气吃什么药| 周长是什么| 肾上腺是什么| 隐晦是什么意思| 中班小朋友应该学什么| 交警中队长是什么级别| 滑胎是什么意思| 盗汗是什么原因| 出其不意下一句是什么| 熊猫是什么科| 寒包火感冒吃什么药| 双肺间质性改变是什么意思| 什么狗不会咬人| 二氧化钛是什么| 什么程度下病危通知书| 痛风挂什么科就医| 啊囊死给什么意思| 很能睡觉是什么原因| 子什么意思| 摸摸唱是什么意思| 规格型号是什么意思| 肾不好会出现什么症状| 淋巴癌是什么| 口苦口干是什么原因引起的| 上半身皮肤痒什么原因| 羁什么意思| 癫痫病是什么原因引起的| 宫颈纳氏囊肿什么意思| 卧底归来大结局是什么| 思维方式是什么意思| 世界八大奇迹分别是什么| 马云是什么大学毕业的| 水保是什么| 狗狗为什么喜欢舔人| 衣衫褴褛是什么意思| 幽门螺杆菌是什么| 皮炎吃什么药| 传导阻滞吃什么药| 试管婴儿是什么意思| 钦此是什么意思| 细菌性前列腺炎有什么症状| 丝瓜什么人不能吃| 产后42天复查都检查什么| 头发染什么颜色显皮肤白显年轻| 尔时是什么意思| 运动员心率为什么慢| 燕窝有什么功效和作用| 农历6月是什么星座| 吃什么可以快速减肥| 心脏搭桥是什么病| 什么是湿气| 女生右手食指戴戒指什么意思| 接龙是什么意思| 陕西有什么烟| 96120是什么电话| 支配是什么意思| 鸡米头是什么| 大咖什么意思| cafe是什么意思| 小孩抽多动症吃什么药最好| 一直咳嗽不好是什么原因| 什么东西去火| male是什么意思| 经常便秘吃什么调理| 吃什么不长肉| 鸡属相和什么属相最配| 手五行属什么| 百度

Thrift interface description language

For Thrift version 0.23.0.

The Thrift interface definition language (IDL) allows for the definition of Thrift Types. A Thrift IDL file is processed by the Thrift code generator to produce code for the various target languages to support the defined structs and services in the IDL file.

Description

Here is a description of the Thrift IDL.

Document

Every Thrift document contains 0 or more headers followed by 0 or more definitions.

[1]  Document        ::=  Header* Definition*

A header is either a Thrift include, a C++ include, or a namespace declaration.

[2]  Header          ::=  Include | CppInclude | Namespace

Thrift Include

An include makes all the symbols from another file visible (with a prefix) and adds corresponding include statements into the code generated for this Thrift document.

[3]  Include         ::=  'include' Literal

C++ Include

A C++ include adds a custom C++ include to the output of the C++ code generator for this Thrift document.

[4]  CppInclude      ::=  'cpp_include' Literal

Namespace

A namespace declares which namespaces/package/module/etc. the type definitions in this file will be declared in for the target languages. The namespace scope indicates which language the namespace applies to; a scope of ‘*’ indicates that the namespace applies to all target languages.

[5]  Namespace       ::=  ( 'namespace' ( NamespaceScope Identifier ) )

[6]  NamespaceScope  ::=  '*' | 'c_glib' | 'cpp' | 'delphi' | 'haxe' | 'go' | 'java' | 'js' | 'lua' | 'netstd' | 'perl' | 'php' | 'py' | 'py.twisted' | 'rb' | 'st' | 'xsd'

Definition

[7]  Definition      ::=  Const | Typedef | Enum | Struct | Union | Exception | Service

Const

[8]  Const           ::=  'const' FieldType Identifier '=' ConstValue ListSeparator?

Typedef

A typedef creates an alternate name for a type.

[9]  Typedef         ::=  'typedef' DefinitionType Identifier

Enum

An enum creates an enumerated type, with named values. If no constant value is supplied, the value is either 0 for the first element, or one greater than the preceding value for any subsequent element. Any constant value that is supplied must be non-negative.

[10] Enum            ::=  'enum' Identifier '{' (Identifier ('=' IntConstant)? ListSeparator?)* '}'

Struct

Structs are the fundamental compositional type in Thrift. The name of each field must be unique within the struct.

[11] Struct          ::=  'struct' Identifier 'xsd_all'? '{' Field* '}'

N.B.: The xsd_all keyword has some purpose internal to Facebook but serves no purpose in Thrift itself. Use of this feature is strongly discouraged

Union

Unions are similar to structs, except that they provide a means to transport exactly one field of a possible set of fields, just like union {} in C++. Consequently, union members are implicitly considered optional (see requiredness).

[12] Union          ::=  'union' Identifier 'xsd_all'? '{' Field* '}'

N.B.: The xsd_all keyword has some purpose internal to Facebook but serves no purpose in Thrift itself. Use of this feature is strongly discouraged

Exception

Exceptions are similar to structs except that they are intended to integrate with the native exception handling mechanisms in the target languages. The name of each field must be unique within the exception.

[13] Exception       ::=  'exception' Identifier '{' Field* '}'

Service

A service provides the interface for a set of functionality provided by a Thrift server. The interface is simply a list of functions. A service can extend another service, which simply means that it provides the functions of the extended service in addition to its own.

[14] Service         ::=  'service' Identifier ( 'extends' Identifier )? '{' Function* '}'

Field

[15] Field           ::=  FieldID? FieldReq? FieldType Identifier ('=' ConstValue)? XsdFieldOptions ListSeparator?

Field ID

[16] FieldID         ::=  IntConstant ':'

Field Requiredness

There are two explicit requiredness values, and a third one that is applied implicitly if neither required nor optional are given: default requiredness.

[17] FieldReq        ::=  'required' | 'optional' 

The general rules for requiredness are as follows:

required

If a required field is missing during read, the expected behaviour is to indicate an unsuccessful read operation to the caller, e.g. by throwing an exception or returning an error.

Because of this behaviour, required fields drastically limit the options with regard to soft versioning. Because they must be present on read, the fields cannot be deprecated. If a required field would be removed (or changed to optional), the data are no longer compatible between versions.

optional

Most language implementations use the recommended practice of so-called “isset” flags to indicate whether a particular optional field is set or not. Only fields with this flag set are written, and conversely the flag is only set when a field value has been read from the input stream.

default requiredness (implicit)

Default requiredness is a good starting point. The desired behaviour is a mix of optional and required, hence the internal name “opt-in, req-out”. Although in theory these fields are supposed to be written (“req-out”), in reality unset fields are not always written. This is especially the case, when the field contains a value, which by definition cannot be transported through thrift. The only way to achieve this is by not writing that field at all, and that's what most languages do.

Semantics of Default Values

There are ongoing discussions about that topic, see JIRA for details. Not all implementations treat default values in the very same way, but the current status quo is more or less that default fields are typically set at initialization time. Therefore, a value that equals the default may not be written, because the read end will set the value implicitly. On the other hand, an implementation is free to write the default value anyways, as there is no hard restriction that prevents this.

The major point to keep in mind here is the fact, that any unwritten default value implicitly becomes part of the interface version. If that default is changed, the interface changes. If, in contrast, the default value is written into the output data, the default in the IDL can change at any time without affecting serialized data.

XSD Options

N.B.: These have some internal purpose at Facebook but serve no current purpose in Thrift. The use of these options is strongly discouraged.

[18] XsdFieldOptions ::=  'xsd_optional'? 'xsd_nillable'? XsdAttrs?

[19] XsdAttrs        ::=  'xsd_attrs' '{' Field* '}'

Functions

[20] Function        ::=  'oneway'? FunctionType Identifier '(' Field* ')' Throws? ListSeparator?

[21] FunctionType    ::=  FieldType | 'void'

[22] Throws          ::=  'throws' '(' Field* ')'

Types

[23] FieldType       ::=  Identifier | BaseType | ContainerType

[24] DefinitionType  ::=  BaseType | ContainerType

[25] BaseType        ::=  'bool' | 'byte' | 'i8' | 'i16' | 'i32' | 'i64' | 'double' | 'string' | 'binary' | 'uuid'

[26] ContainerType   ::=  MapType | SetType | ListType

[27] MapType         ::=  'map' CppType? '<' FieldType ',' FieldType '>'

[28] SetType         ::=  'set' CppType? '<' FieldType '>'

[29] ListType        ::=  'list' CppType? '<' FieldType '>' 

[30] CppType         ::=  'cpp_type' Literal

Constant Values

[31] ConstValue      ::=  IntConstant | DoubleConstant | Literal | Identifier | ConstList | ConstMap

[32] IntConstant     ::=  ('+' | '-')? Digit+

[33] DoubleConstant  ::=  ('+' | '-')? Digit* ('.' Digit+)? ( ('E' | 'e') IntConstant )?

[34] ConstList       ::=  '[' (ConstValue ListSeparator?)* ']'

[35] ConstMap        ::=  '{' (ConstValue ':' ConstValue ListSeparator?)* '}'

Basic Definitions

Literal

[36] Literal         ::=  ('"' [^"]* '"') | ("'" [^']* "'")

Identifier

[37] Identifier      ::=  ( Letter | '_' ) ( Letter | Digit | '.' | '_' )*

[38] STIdentifier    ::=  ( Letter | '_' ) ( Letter | Digit | '.' | '_' | '-' )*

List Separator

[39] ListSeparator   ::=  ',' | ';'

Letters and Digits

[40] Letter          ::=  ['A'-'Z'] | ['a'-'z']

[41] Digit           ::=  ['0'-'9']

Reserved keywords

"BEGIN", "END", "__CLASS__", "__DIR__", "__FILE__", "__FUNCTION__",
"__LINE__", "__METHOD__", "__NAMESPACE__", "abstract", "alias", "and", "args", "as",
"assert", "begin", "break", "case", "catch", "class", "clone", "continue", "declare",
"def", "default", "del", "delete", "do", "dynamic", "elif", "else", "elseif", "elsif",
"end", "enddeclare", "endfor", "endforeach", "endif", "endswitch", "endwhile", "ensure",
"except", "exec", "finally", "float", "for", "foreach", "from", "function", "global",
"goto", "if", "implements", "import", "in", "inline", "instanceof", "interface", "is",
"lambda", "module", "native", "new", "next", "nil", "not", "or", "package", "pass",
"public", "print", "private", "protected", "raise", "redo", "rescue", "retry", "register",
"return", "self", "sizeof", "static", "super", "switch", "synchronized", "then", "this",
"throw", "transient", "try", "undef", "unless", "unsigned", "until", "use", "var",
"virtual", "volatile", "when", "while", "with", "xor", "yield" 

Examples

Here are some examples of Thrift definitions, using the Thrift IDL:

To Do/Questions

Initialization of Base Types for all Languages?

Why does position of CppType vary between SetType and ListType?

Why can’t DefinitionType be the same as FieldType (i.e. include Identifier)?

Examine the smalltalk.prefix and smalltalk.category status (esp smalltalk.category, which takes STIdentifier as its argument)…

What to do about ListSeparator? Do we really want to be as lax as we currently are?

Should Field* really be Field+ in Struct, Enum, etc.?


血热吃什么药好得快 诸君是什么意思 全身淋巴结肿大是什么原因 男人交公粮什么意思 槟榔为什么上瘾
急性支气管炎吃什么药 胃腺息肉什么意思 什么是胃溃疡 后囟门什么时候闭合 吃什么有助于伤口愈合
喉咙有痰咳嗽是什么原因 空调制冷效果差是什么原因 肝火旺盛喝什么茶 吃什么瘦肚子最快 脸颊两侧长斑是什么原因怎么调理
杏花代表什么生肖 女性腰酸是什么原因引起的 血脂高吃什么油好 ecg是什么意思 吃什么鱼最健康
风湿性心脏病是什么原因引起的hcv9jop5ns1r.cn 喝桦树茸有什么好处hcv9jop2ns5r.cn 玻璃什么时候传入中国hcv8jop9ns2r.cn 内科主要看什么病zsyouku.com 5月12是什么星座kuyehao.com
处女座和什么座最配对wuhaiwuya.com 1月21号什么星座tiangongnft.com 杨枝甘露是什么0735v.com 毛骨鱼是什么鱼hcv8jop5ns2r.cn 吃葵花籽有什么好处和坏处吗hcv8jop3ns6r.cn
karen是什么意思gysmod.com 脑梗看什么科hcv8jop0ns3r.cn 毛囊炎吃什么药最有效hcv9jop0ns4r.cn 鱼腥草破壁饮片有什么功效hcv8jop8ns2r.cn 红绿色盲是什么遗传病hcv9jop7ns5r.cn
慢性胃炎能吃什么水果hcv8jop7ns9r.cn 脚气挂什么科室hcv7jop9ns6r.cn 口腔扁平苔藓吃什么药hcv8jop5ns0r.cn 爱屋及乌是什么意思hcv8jop1ns1r.cn 什么是八字生辰八字hcv9jop2ns3r.cn
百度