Skip to content
EntityQ266257· pop 12· linked from 440 articles

Apache Thrift

Sign in to save

data serialization format

In the Vinony graph

Vinony's link graph records 440 inbound references to Apache Thrift, and connects out to WhatsApp, Meta and Apache Software Foundation.

It is catalogued under topics including Apache Software Foundation projects, Application layer protocols and Data serialization formats.

Vinony links it to 10 Wikipedia language editions.

Official website

Apache Thrift - Home

thrift.apache.org →

Link to the official site · 7,690 chars · not written by Vinony

Described at

dance,focusingonthekey typesavailableinallprogramminglan- guages,ommittingany nichetypesavailableonlyinspecificlan- guages. ThebasetypessupportedbyThriftare:  boolA booleanvalue,trueorfalse  byteA signedbyte  i16A 16-bitsignedinteger  i32A 32-bitsignedinteger  i64A 64-bitsignedinteger  doubleA 64-bitfloatingpointnumber  stringAnencoding-agnostictextorbinarystring Ofparticularnoteis theabsenceofunsignedintegertypes.Because thesetypeshave nodirecttranslationtonative primitive types inmany languages,theadvantagesthey affordarelost.Further, thereis nowaytopreventtheapplicationdeveloperina language like Pythonfromassigninga negative valuetoanintegervariable, leadingtounpredictablebehavior. Froma designstandpoint,we observedthatunsignedintegerswereveryrarely, if ever, usedfor arithmeticpurposes,butinpracticeweremuchmoreoftenused askeysoridentifiers.Inthiscase,thesignisirrelevant.Signed integersserve thissamepurposeandcanbesafelycasttotheir unsignedcounterparts(mostcommonlyinC++)whenabsolutely necessary. 2.2Structs AThriftstructdefinesa commonobjecttobeusedacrosslan- guages.Astructisessentiallyequivalenttoa classinobjectori- entedprogramminglanguages.A structhasa setofstronglytyped fields,eachwitha uniquenameidentifier. Thebasicsyntaxfor defininga Thriftstructlooksverysimilartoa C structdefinition. Fieldsmaybeannotatedwithanintegerfieldidentifier(uniqueto thescopeofthatstruct)andoptionaldefaultvalues.Fieldidentifiers willbeautomaticallyassignedif omitted,thoughthey arestrongly encouragedforversioningreasonsdiscussedlater. 2.3Containers Thriftcontainersarestronglytypedcontainersthatmaptothemost commonlyusedcontainersincommonprogramminglanguages. They areannotatedusingtheC++template(orJava Generics)style. Therearethreetypesavailable:  list<type>Anorderedlistofelements.Translatesdirectly intoanSTLvector, JavaArrayList, ornative arrayinscript- inglanguages.Maycontainduplicates.  set<type>Anunorderedsetofuniqueelements.Translates intoanSTLset, JavaHashSet,setinPython,ornative dictionaryinPHP/Ruby.  map<type1,type2>Amapofstrictlyuniquekeystovalues TranslatesintoanSTLmap, JavaHashMap, PHPassociative array, orPython/Rubydictionary. Whiledefaultsareprovided,thetypemappingsarenotexplic- itlyfixed.Customcodegeneratordirectiveshave beenaddedto substitutecustomtypesindestinationlanguages(i.e.hash mapor Google’s sparsehashmapcanbeusedinC++).Theonlyrequire- mentisthatthecustomtypessupportallthenecessaryiteration primitives.Containerelementsmaybeofany validThrifttype,in- cludingothercontainersorstructs. structExample{ 1:i32number=10, 2:i64bigNumber, 3:doubledecimals, 4:stringname="thrifty" } Inthetargetlanguage,eachdefinitiongeneratesa typewithtwo methods,readandwrite, whichperformserializationandtrans- portoftheobjectsusinga ThriftTProtocolobject. 2.4Exceptions Exceptionsaresyntacticallyandfunctionallyequivalenttostructs exceptthatthey aredeclaredusingtheexceptionkeywordinstead ofthestructkeyword. Thegeneratedobjectsinheritfromanexceptionbaseclassasap- propriateineachtargetprogramminglanguage,inordertoseam- lesslyintegratewithnative exceptionhandlinginany givenlan- guage.Again,thedesignemphasisis onmakingthecodefamiliar totheapplicationdeveloper. 2.5Services ServicesaredefinedusingThrifttypes.Definitionofa serviceis semanticallyequivalenttodefininganinterface(ora purevirtual abstractclass)in objectorientedprogramming.TheThriftcompiler generatesfullyfunctionalclientandserver stubsthatimplementthe interface.Servicesaredefinedasfollows: service<name>{ <returntype><name>(<arguments>) [throws(<exceptions>)] ... } Anexample: serviceStringCache{ voidset(1:i32key,2:stringvalue), stringget(1:i32key)throws(1:KeyNotFoundknf), voiddelete(1:i32key) } Notethatvoidisa validtypefora functionreturn,inaddition toallotherdefinedThrifttypes.Additionally, anasyncmodifier keywordmaybeaddedtoavoidfunction,whichwillgenerate codethatdoesnotwaitfora responsefromtheserver. Notethata purevoidfunctionwillretur

Excerpt from a page describing this subject · 38,933 chars · not written by Vinony

Wikidata facts

Official website
thrift.apache.org
Show 11 more facts
operating system
Microsoft Windows
software version identifier
0.22.0
programmed in
Smalltalk
source code repository URL
github.com/apache/thrift.git
publication date
2007-00-00
inception
2012-04-14
Commons category
Apache Thrift
Sources (3)

via Wikidata · CC0

Article · Русский

Thrift (с англ. — «бережливость», произносится как [θrift]) — язык описания интерфейсов, который используется для определения и создания служб под разные языки программирования. Является фреймворком к удалённому вызову процедур (RPC). Используется компанией Facebook в качестве масштабируемого кросс-языкового сервиса по разработке. Сочетает в себе программный конвейер с движком генерации кода для разработки служб, в той или иной степени эффективно и легко работающих между такими языками как C#, C++, Cappuccino, Cocoa, Delphi, Erlang, Go, Haskell, Java, OCaml, Perl, PHP, Python, Ruby, Rust, Smalltalk и JavaScript. Проще говоря, Thrift является двоичным протоколом связи. С апреля 2007 разрабатывается как open source проект некоммерческой организации Apache Software Foundation.

Abstract from DBpedia / Wikipedia · CC BY-SA

Available in 10 languages

via Wikidata sitelinks · CC0

Connections

Categories