日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

clientcontainerThrift Types

發(fā)布時間:2023/11/27 生活经验 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 clientcontainerThrift Types 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

首先聲明,我是一個菜鳥。一下文章中出現(xiàn)技術(shù)誤導(dǎo)情況蓋不負責(zé)

????來自Apache Thrift官網(wǎng):Thrift Types

????

Thrift Types

????

The Thrift type system is intended to allow programmers to use native types as much as possible, no matter what programming language they are working in. This information is based on, and supersedes, the information in the?Thrift Whitepaper. The?Thrift IDL?provides descriptions of the types which are used to generate code for each target language.

????

Base Types

????

The base types were selected with the goal of simplicity and clarity rather than abundance, focusing on the key types available in all programming languages.

????

  • bool: A boolean value (true or false)
  • byte: An 8-bit signed integer
  • i16: A 16-bit signed integer
  • i32: A 32-bit signed integer
  • i64: A 64-bit signed integer
  • double: A 64-bit floating point number
  • string: A text string encoded using UTF-8 encoding

????

Note the absence of unsigned integer types. This is due to the fact that there are no native unsigned integer types in many programming languages.

????

Special Types

????

binary: a sequence of unencoded bytes

????

N.B.: This is currently a specialized form of the string type above, added to provide better interoperability with Java. The current plan-of-record is to elevate this to a base type at some point.

????

Structs

????

Thrift structs define a common object – they are essentially equivalent to classes in OOP languages, but without inheritance. A struct has a set of strongly typed fields, each with a unique name identifier. Fields may have various annotations (numeric field IDs, optional default values, etc.) that are described in the?Thrift IDL.

????

Containers

每日一道理
青春是用意志的血滴和拼搏的汗水釀成的瓊漿——歷久彌香;青春是用不凋的希望和不滅的向往編織的彩虹——絢麗輝煌;青春是用永恒的執(zhí)著和頑強的韌勁筑起的一道銅墻鐵壁——固若金湯。

????

Thrift containers are strongly typed containers that map to commonly used and commonly available container types in most programming languages.

????

There are three container types:

????

list: An ordered list of elements. Translates to an STL vector, Java ArrayList, native arrays in scripting languages, etc. set: An unordered set of unique elements. Translates to an STL set, Java HashSet, set in Python, etc. Note: PHP does not support sets, so it is treated similar to a List map: A map of strictly unique keys to values. Translates to an STL map, Java HashMap, PHP associative array, Python/Ruby dictionary, etc. While defaults are provided, the type mappings are not explicitly fixed. Custom code generator directives have been added to allow substitution of custom types in various destination languages.

????

Container elements may be of any valid Thrift Type.

????

N.B.: For maximal compatibility, the key type for map should be a basic type rather than a struct or container type. There are some languages which do not support more complex key types in their native map types. In addition the JSON protocol only supports key types that are base types.

????

Exceptions

????

Exceptions are functionally equivalent to structs, except that they inherit from the native exception base class as appropriate in each target programming language, in order to seamlessly integrate with the native exception handling in any given language.

????

Services

????

Services are defined using Thrift types. Definition of a service is semantically equivalent to defining an interface (or a pure virtual abstract class) in object oriented programming. The Thrift compiler generates fully functional client and server stubs that implement the interface.

????

A service consists of a set of named functions, each with a list of parameters and a return type.

????

Note that void is a valid type for a function return, in addition to all other defined Thrift types. Additionally, an async modifier keyword may be added to a void function, which will generate code that does not wait for a response. Note that a pure void function will return a response to the client which guarantees that the operation has completed on the server side. With async method calls the client will only be guaranteed that the request succeeded at the transport layer. Async method calls of the same client may be executed in parallel/out of order by the server.

文章結(jié)束給大家分享下程序員的一些笑話語錄: 問:你覺得讓你女朋友(或者任何一個女的)從你和李彥宏之間選一個,你覺得她會選誰?  
  答:因為李艷紅這種敗類,所以我沒女友!

--------------------------------- 原創(chuàng)文章 By
client和container
---------------------------------

轉(zhuǎn)載于:https://www.cnblogs.com/jiangu66/archive/2013/05/24/3098111.html

總結(jié)

以上是生活随笔為你收集整理的clientcontainerThrift Types的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。