blob: c8db1b5b99b00e4e505044b9fa2e3ff9c673a2be [file] [log] [blame] [view]
Roger Meier5aaa0212010-11-04 12:20:05 +00001Apache Thrift
Roger Meier16fcad02014-03-16 21:12:11 +01002=============
Marc Slemko9de5a5c2006-08-23 22:34:00 +00003
James E. King IIIc7fe3f42018-06-27 11:01:16 -04004Introduction
5============
6
James E. King III6ba58e92019-05-13 07:21:21 -04007Thrift is a lightweight, language-independent software stack for
8point-to-point RPC implementation.
9Thrift provides clean abstractions and implementations for data transport,
10data serialization, and application level processing. The code generation
11system takes a simple definition language as input and generates code
12across programming languages that uses the abstracted stack to build
13interoperable RPC clients and servers.
James E. King IIIc7fe3f42018-06-27 11:01:16 -040014
15![Apache Thrift Layered Architecture](doc/images/thrift-layers.png)
16
17Thrift makes it easy for programs written in different programming
Jiayu Liu096a0612022-10-11 11:46:25 +080018languages to share data and call remote procedures. With support
19for [28 programming languages](LANGUAGES.md), chances are Thrift
James E. King IIIc7fe3f42018-06-27 11:01:16 -040020supports the languages that you currently use.
21
22Thrift is specifically designed to support non-atomic version changes
James E. King III6ba58e92019-05-13 07:21:21 -040023across client and server code. This allows you to upgrade your
Salah Ghanim24ca2102020-06-24 12:21:10 +020024server while still being able to service older clients; or have newer
James E. King III6ba58e92019-05-13 07:21:21 -040025clients issue requests to older servers. An excellent community-provided
26write-up about thrift and compatibility when versioning an API can be
27found in the [Thrift Missing Guide](https://diwakergupta.github.io/thrift-missing-guide/#_versioning_compatibility).
James E. King IIIc7fe3f42018-06-27 11:01:16 -040028
29For more details on Thrift's design and implementation, see the Thrift
30whitepaper included in this distribution, or at the README.md file
31in your particular subdirectory of interest.
32
33Status
34======
35
36| Branch | Travis | Appveyor | Coverity Scan | codecov.io | Website |
37| :----- | :----- | :------- | :------------ | :--------- | :------ |
Jiayu Liu096a0612022-10-11 11:46:25 +080038| [`master`](https://github.com/apache/thrift/tree/master) | [![Build Status](https://api.travis-ci.com/apache/thrift.svg?branch=master)](https://app.travis-ci.com/apache/thrift/branches) | [![Build status](https://ci.appveyor.com/api/projects/status/github/apache/thrift?branch=master&svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/history) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/1345/badge.svg)](https://scan.coverity.com/projects/thrift) | | [![Website](https://img.shields.io/badge/official-website-brightgreen.svg)](https://thrift.apache.org/) |
39| [`0.17.0`](https://github.com/apache/thrift/tree/0.17.0) | [![Build Status](https://api.travis-ci.com/apache/thrift.svg?branch=0.17.0)](https://app.travis-ci.com/apache/thrift/branches) | | | | |
James E. King IIIc7fe3f42018-06-27 11:01:16 -040040
41Releases
42========
43
Jiayu Liu096a0612022-10-11 11:46:25 +080044Thrift does not maintain a specific release calendar at this time.
James E. King IIIc7fe3f42018-06-27 11:01:16 -040045
46We strive to release twice yearly. Download the [current release](http://thrift.apache.org/download).
Marc Slemko9de5a5c2006-08-23 22:34:00 +000047
Bryan Duxburydef30a62009-04-08 00:19:37 +000048License
49=======
50
51Licensed to the Apache Software Foundation (ASF) under one
52or more contributor license agreements. See the NOTICE file
53distributed with this work for additional information
54regarding copyright ownership. The ASF licenses this file
55to you under the Apache License, Version 2.0 (the
56"License"); you may not use this file except in compliance
57with the License. You may obtain a copy of the License at
58
59 http://www.apache.org/licenses/LICENSE-2.0
60
61Unless required by applicable law or agreed to in writing,
62software distributed under the License is distributed on an
63"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
64KIND, either express or implied. See the License for the
65specific language governing permissions and limitations
66under the License.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000067
James E. King, III0ad20bd2017-09-30 15:44:16 -070068Project Hierarchy
69=================
Mark Slee3303f362007-03-05 20:09:37 +000070
71thrift/
72
73 compiler/
Randy Abernethyb92f6362015-08-30 10:56:35 -070074
Mark Slee3303f362007-03-05 20:09:37 +000075 Contains the Thrift compiler, implemented in C++.
76
77 lib/
Randy Abernethyb92f6362015-08-30 10:56:35 -070078
Mark Slee3303f362007-03-05 20:09:37 +000079 Contains the Thrift software library implementation, subdivided by
80 language of implementation.
81
82 cpp/
Jens Geyer0853ab62013-12-17 21:38:44 +010083 go/
Mark Slee3303f362007-03-05 20:09:37 +000084 java/
85 php/
86 py/
Mark Slee227ac2c2007-03-07 05:46:50 +000087 rb/
James E. King, III0ad20bd2017-09-30 15:44:16 -070088 ...
Mark Slee3303f362007-03-05 20:09:37 +000089
90 test/
91
92 Contains sample Thrift files and test code across the target programming
93 languages.
94
Mark Slee227ac2c2007-03-07 05:46:50 +000095 tutorial/
96
97 Contains a basic tutorial that will teach you how to develop software
98 using Thrift.
Marc Slemko9de5a5c2006-08-23 22:34:00 +000099
James E. King IIIc7fe3f42018-06-27 11:01:16 -0400100Development
101===========
102
103To build the same way Travis CI builds the project you should use docker.
104We have [comprehensive building instructions for docker](build/docker/README.md).
105
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000106Requirements
107============
Mark Slee3303f362007-03-05 20:09:37 +0000108
PoojaChandak20205b82020-11-06 11:33:40 +0100109See http://thrift.apache.org/docs/install for a list of build requirements (may be stale). Alternatively, see the docker build environments for a list of prerequisites.
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000110
111Resources
112=========
113
114More information about Thrift can be obtained on the Thrift webpage at:
115
Roger Meier5aaa0212010-11-04 12:20:05 +0000116 http://thrift.apache.org
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000117
118Acknowledgments
119===============
120
Greg Steinf0d35d22009-01-30 19:10:27 +0000121Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo,
122and also by Google's protocol buffers.
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000123
Mark Slee54b7ab92007-03-06 00:06:27 +0000124Installation
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000125============
126
Mark Slee57cc25e2007-02-28 21:43:54 +0000127If you are building from the first time out of the source repository, you will
David Reissb72d19f2007-09-18 19:46:00 +0000128need to generate the configure scripts. (This is not necessary if you
129downloaded a tarball.) From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000130
Roger Meiere9f00cb2014-05-30 14:35:34 +0200131 ./bootstrap.sh
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000132
Mark Slee57cc25e2007-02-28 21:43:54 +0000133Once the configure scripts are generated, thrift can be configured.
134From the top directory, do:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000135
Roger Meiere9f00cb2014-05-30 14:35:34 +0200136 ./configure
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000137
Mark Slee57cc25e2007-02-28 21:43:54 +0000138You may need to specify the location of the boost files explicitly.
Ting Sun518163a2021-01-24 00:18:46 +0800139If you installed boost in `/usr/local`, you would run configure as follows:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000140
Roger Meiere9f00cb2014-05-30 14:35:34 +0200141 ./configure --with-boost=/usr/local
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000142
Mark Slee3303f362007-03-05 20:09:37 +0000143Note that by default the thrift C++ library is typically built with debugging
144symbols included. If you want to customize these options you should use the
145CXXFLAGS option in configure, as such:
Mark Slee29050782006-09-29 00:12:30 +0000146
Roger Meiere9f00cb2014-05-30 14:35:34 +0200147 ./configure CXXFLAGS='-g -O2'
148 ./configure CFLAGS='-g -O2'
149 ./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
150
151To enable gcov required options -fprofile-arcs -ftest-coverage enable them:
152
153 ./configure --enable-coverage
Mark Slee29050782006-09-29 00:12:30 +0000154
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000155Run ./configure --help to see other configuration options
156
David Reissaea19c92007-08-29 23:17:32 +0000157Please be aware that the Python library will ignore the --prefix option
158and just install wherever Python's distutils puts it (usually along
Ting Sun518163a2021-01-24 00:18:46 +0800159the lines of `/usr/lib/pythonX.Y/site-packages/`). If you need to control
David Reissd6832192007-09-05 00:47:32 +0000160where the Python modules are installed, set the PY_PREFIX variable.
161(DESTDIR is respected for Python and C++.)
David Reissaea19c92007-08-29 23:17:32 +0000162
Mark Slee227ac2c2007-03-07 05:46:50 +0000163Make thrift:
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000164
zeshuai007348790d2020-03-23 16:48:35 +0800165 make
Marc Slemko9de5a5c2006-08-23 22:34:00 +0000166
167From the top directory, become superuser and do:
168
zeshuai007348790d2020-03-23 16:48:35 +0800169 make install
170
171Uninstall thrift:
172
173 make uninstall
Mark Slee54b7ab92007-03-06 00:06:27 +0000174
Mark Slee227ac2c2007-03-07 05:46:50 +0000175Note that some language packages must be installed manually using build tools
176better suited to those languages (at the time of this writing, this applies
177to Java, Ruby, PHP).
178
Roger Meier16fcad02014-03-16 21:12:11 +0100179Look for the README.md file in the lib/<language>/ folder for more details on the
Mark Slee54b7ab92007-03-06 00:06:27 +0000180installation of each language library package.
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400181
JackBoosY829b7d32020-01-16 00:38:15 -0800182Package Managers
183================
184
Jiayu Liu096a0612022-10-11 11:46:25 +0800185Apache Thrift is available via a number of package managers, a list which is
186is steadily growing. A more detailed overview can be found
187[at the Apache Thrift web site under "Libraries"](http://thrift.apache.org/lib/)
PoojaChandak20205b82020-11-06 11:33:40 +0100188and/or in the respective READMEs for each language under /lib
JackBoosY829b7d32020-01-16 00:38:15 -0800189
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400190Testing
191=======
192
193There are a large number of client library tests that can all be run
194from the top-level directory.
195
zeshuai007348790d2020-03-23 16:48:35 +0800196 make -k check
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400197
198This will make all of the libraries (as necessary), and run through
199the unit tests defined in each of the client libraries. If a single
200language fails, the make check will continue on and provide a synopsis
201at the end.
202
203To run the cross-language test suite, please run:
204
zeshuai007348790d2020-03-23 16:48:35 +0800205 make cross
Carl Yeksigiane2c5b2d2013-06-06 07:24:51 -0400206
207This will run a set of tests that use different language clients and
Jens Geyer0853ab62013-12-17 21:38:44 +0100208servers.
James E. King, III254e86b2017-10-25 09:02:48 -0400209
James E. King, IIIcfb01302017-11-11 09:39:19 -0500210