thrift特點介紹

Apache Thrift Features

· interface description language - Everything is specified in an IDL file from which bindings for many languages can be generated. See Thirft IDL

· language bindings - Thrift is supported in many languages and environments

· C++

· C#

· Cocoa

· D

· Delphi

· Erlang

· Haskell

· Java

· OCaml

· Perl

· PHP

· Python

· Ruby

· Smalltalk

· namespaces - Each Thrift file is in its own namespace allowing you to use the same identifier in multiple Thrift files

· language namespaces - Per Thrift file you can specify which namespace should be used for each programming language

· base types - Thrift has a small set of base types. See Thrift Types

· constants and enumerations - Constant values can be assigned logical names

· structs - Use structs to group related data. Structs can have fields of any type. See Thrift Types

· sparse structs - Optional base fields that have not been set and reference fields that are null will not be sent across the wire

· struct evolution - The addition and removal of fields is handled without breaking existing clients by using integer identifiers for fields

· containers - You can use sets, lists and maps of any type: base types, structs and other containers. See Thrift Types

· type definitions - Any type can be given a name that better describes it

· services - A service is a group of functions

· service inheritance - Subservices implement all functions of their base services and can have additional functions

· asynchronous invocations - Functions that do not return a result can be invoked asynchronously so the client is not blocked until the server has finished processing the request. The server may execute asynchronous invocations of the same client in parallel/out of order

· exceptions - If an error occurs a function can throw a standard or user-defined exception. See Thrift Types

Non-features

The following are not supported by Apache Thrift:

· cyclic structs - Structs can only contain structs that have been declared before it. A struct also cannot contain itself

· struct inheritance - Use struct composition instead

· polymorphism - As there is no inheritance, polymorphism is also not supported

· overloading - All methods within a service must be uniquely named

· heterogeneous containers - All items in a container must be of the same type

· Null return - null cannot be returned directly from a function. Use a wrapper struct or a marker value instead

發佈了59 篇原創文章 · 獲贊 2 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章