| Roger Meier | 5aaa021 | 2010-11-04 12:20:05 +0000 | [diff] [blame] | 1 | Apache Thrift |
| Roger Meier | 16fcad0 | 2014-03-16 21:12:11 +0100 | [diff] [blame] | 2 | ============= |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 3 | |
| James E. King III | c7fe3f4 | 2018-06-27 11:01:16 -0400 | [diff] [blame] | 4 | Introduction |
| 5 | ============ |
| 6 | |
| James E. King III | 6ba58e9 | 2019-05-13 07:21:21 -0400 | [diff] [blame] | 7 | Thrift is a lightweight, language-independent software stack for |
| 8 | point-to-point RPC implementation. |
| 9 | Thrift provides clean abstractions and implementations for data transport, |
| 10 | data serialization, and application level processing. The code generation |
| 11 | system takes a simple definition language as input and generates code |
| 12 | across programming languages that uses the abstracted stack to build |
| 13 | interoperable RPC clients and servers. |
| James E. King III | c7fe3f4 | 2018-06-27 11:01:16 -0400 | [diff] [blame] | 14 | |
| 15 |  |
| 16 | |
| 17 | Thrift makes it easy for programs written in different programming |
| Jiayu Liu | 096a061 | 2022-10-11 11:46:25 +0800 | [diff] [blame] | 18 | languages to share data and call remote procedures. With support |
| 19 | for [28 programming languages](LANGUAGES.md), chances are Thrift |
| James E. King III | c7fe3f4 | 2018-06-27 11:01:16 -0400 | [diff] [blame] | 20 | supports the languages that you currently use. |
| 21 | |
| 22 | Thrift is specifically designed to support non-atomic version changes |
| James E. King III | 6ba58e9 | 2019-05-13 07:21:21 -0400 | [diff] [blame] | 23 | across client and server code. This allows you to upgrade your |
| Salah Ghanim | 24ca210 | 2020-06-24 12:21:10 +0200 | [diff] [blame] | 24 | server while still being able to service older clients; or have newer |
| James E. King III | 6ba58e9 | 2019-05-13 07:21:21 -0400 | [diff] [blame] | 25 | clients issue requests to older servers. An excellent community-provided |
| 26 | write-up about thrift and compatibility when versioning an API can be |
| 27 | found in the [Thrift Missing Guide](https://diwakergupta.github.io/thrift-missing-guide/#_versioning_compatibility). |
| James E. King III | c7fe3f4 | 2018-06-27 11:01:16 -0400 | [diff] [blame] | 28 | |
| 29 | For more details on Thrift's design and implementation, see the Thrift |
| 30 | whitepaper included in this distribution, or at the README.md file |
| 31 | in your particular subdirectory of interest. |
| 32 | |
| 33 | Status |
| 34 | ====== |
| 35 | |
| 36 | | Branch | Travis | Appveyor | Coverity Scan | codecov.io | Website | |
| 37 | | :----- | :----- | :------- | :------------ | :--------- | :------ | |
| Jiayu Liu | 096a061 | 2022-10-11 11:46:25 +0800 | [diff] [blame] | 38 | | [`master`](https://github.com/apache/thrift/tree/master) | [](https://app.travis-ci.com/apache/thrift/branches) | [](https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/history) | [](https://scan.coverity.com/projects/thrift) | | [](https://thrift.apache.org/) | |
| 39 | | [`0.17.0`](https://github.com/apache/thrift/tree/0.17.0) | [](https://app.travis-ci.com/apache/thrift/branches) | | | | | |
| James E. King III | c7fe3f4 | 2018-06-27 11:01:16 -0400 | [diff] [blame] | 40 | |
| 41 | Releases |
| 42 | ======== |
| 43 | |
| Jiayu Liu | 096a061 | 2022-10-11 11:46:25 +0800 | [diff] [blame] | 44 | Thrift does not maintain a specific release calendar at this time. |
| James E. King III | c7fe3f4 | 2018-06-27 11:01:16 -0400 | [diff] [blame] | 45 | |
| 46 | We strive to release twice yearly. Download the [current release](http://thrift.apache.org/download). |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 47 | |
| Bryan Duxbury | def30a6 | 2009-04-08 00:19:37 +0000 | [diff] [blame] | 48 | License |
| 49 | ======= |
| 50 | |
| 51 | Licensed to the Apache Software Foundation (ASF) under one |
| 52 | or more contributor license agreements. See the NOTICE file |
| 53 | distributed with this work for additional information |
| 54 | regarding copyright ownership. The ASF licenses this file |
| 55 | to you under the Apache License, Version 2.0 (the |
| 56 | "License"); you may not use this file except in compliance |
| 57 | with the License. You may obtain a copy of the License at |
| 58 | |
| 59 | http://www.apache.org/licenses/LICENSE-2.0 |
| 60 | |
| 61 | Unless required by applicable law or agreed to in writing, |
| 62 | software distributed under the License is distributed on an |
| 63 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 64 | KIND, either express or implied. See the License for the |
| 65 | specific language governing permissions and limitations |
| 66 | under the License. |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 67 | |
| James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 68 | Project Hierarchy |
| 69 | ================= |
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 70 | |
| 71 | thrift/ |
| 72 | |
| 73 | compiler/ |
| Randy Abernethy | b92f636 | 2015-08-30 10:56:35 -0700 | [diff] [blame] | 74 | |
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 75 | Contains the Thrift compiler, implemented in C++. |
| 76 | |
| 77 | lib/ |
| Randy Abernethy | b92f636 | 2015-08-30 10:56:35 -0700 | [diff] [blame] | 78 | |
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 79 | Contains the Thrift software library implementation, subdivided by |
| 80 | language of implementation. |
| 81 | |
| 82 | cpp/ |
| Jens Geyer | 0853ab6 | 2013-12-17 21:38:44 +0100 | [diff] [blame] | 83 | go/ |
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 84 | java/ |
| 85 | php/ |
| 86 | py/ |
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 87 | rb/ |
| James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 88 | ... |
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 89 | |
| 90 | test/ |
| 91 | |
| 92 | Contains sample Thrift files and test code across the target programming |
| 93 | languages. |
| 94 | |
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 95 | tutorial/ |
| 96 | |
| 97 | Contains a basic tutorial that will teach you how to develop software |
| 98 | using Thrift. |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 99 | |
| James E. King III | c7fe3f4 | 2018-06-27 11:01:16 -0400 | [diff] [blame] | 100 | Development |
| 101 | =========== |
| 102 | |
| 103 | To build the same way Travis CI builds the project you should use docker. |
| 104 | We have [comprehensive building instructions for docker](build/docker/README.md). |
| 105 | |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 106 | Requirements |
| 107 | ============ |
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 108 | |
| PoojaChandak | 20205b8 | 2020-11-06 11:33:40 +0100 | [diff] [blame] | 109 | See 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 Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 110 | |
| 111 | Resources |
| 112 | ========= |
| 113 | |
| 114 | More information about Thrift can be obtained on the Thrift webpage at: |
| 115 | |
| Roger Meier | 5aaa021 | 2010-11-04 12:20:05 +0000 | [diff] [blame] | 116 | http://thrift.apache.org |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 117 | |
| 118 | Acknowledgments |
| 119 | =============== |
| 120 | |
| Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 121 | Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo, |
| 122 | and also by Google's protocol buffers. |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 123 | |
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 124 | Installation |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 125 | ============ |
| 126 | |
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 127 | If you are building from the first time out of the source repository, you will |
| David Reiss | b72d19f | 2007-09-18 19:46:00 +0000 | [diff] [blame] | 128 | need to generate the configure scripts. (This is not necessary if you |
| 129 | downloaded a tarball.) From the top directory, do: |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 130 | |
| Roger Meier | e9f00cb | 2014-05-30 14:35:34 +0200 | [diff] [blame] | 131 | ./bootstrap.sh |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 132 | |
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 133 | Once the configure scripts are generated, thrift can be configured. |
| 134 | From the top directory, do: |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 135 | |
| Roger Meier | e9f00cb | 2014-05-30 14:35:34 +0200 | [diff] [blame] | 136 | ./configure |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 137 | |
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 138 | You may need to specify the location of the boost files explicitly. |
| Ting Sun | 518163a | 2021-01-24 00:18:46 +0800 | [diff] [blame] | 139 | If you installed boost in `/usr/local`, you would run configure as follows: |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 140 | |
| Roger Meier | e9f00cb | 2014-05-30 14:35:34 +0200 | [diff] [blame] | 141 | ./configure --with-boost=/usr/local |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 142 | |
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 143 | Note that by default the thrift C++ library is typically built with debugging |
| 144 | symbols included. If you want to customize these options you should use the |
| 145 | CXXFLAGS option in configure, as such: |
| Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 146 | |
| Roger Meier | e9f00cb | 2014-05-30 14:35:34 +0200 | [diff] [blame] | 147 | ./configure CXXFLAGS='-g -O2' |
| 148 | ./configure CFLAGS='-g -O2' |
| 149 | ./configure CPPFLAGS='-DDEBUG_MY_FEATURE' |
| 150 | |
| 151 | To enable gcov required options -fprofile-arcs -ftest-coverage enable them: |
| 152 | |
| 153 | ./configure --enable-coverage |
| Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 154 | |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 155 | Run ./configure --help to see other configuration options |
| 156 | |
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 157 | Please be aware that the Python library will ignore the --prefix option |
| 158 | and just install wherever Python's distutils puts it (usually along |
| Ting Sun | 518163a | 2021-01-24 00:18:46 +0800 | [diff] [blame] | 159 | the lines of `/usr/lib/pythonX.Y/site-packages/`). If you need to control |
| David Reiss | d683219 | 2007-09-05 00:47:32 +0000 | [diff] [blame] | 160 | where the Python modules are installed, set the PY_PREFIX variable. |
| 161 | (DESTDIR is respected for Python and C++.) |
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 162 | |
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 163 | Make thrift: |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 164 | |
| zeshuai007 | 348790d | 2020-03-23 16:48:35 +0800 | [diff] [blame] | 165 | make |
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 166 | |
| 167 | From the top directory, become superuser and do: |
| 168 | |
| zeshuai007 | 348790d | 2020-03-23 16:48:35 +0800 | [diff] [blame] | 169 | make install |
| 170 | |
| 171 | Uninstall thrift: |
| 172 | |
| 173 | make uninstall |
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 174 | |
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 175 | Note that some language packages must be installed manually using build tools |
| 176 | better suited to those languages (at the time of this writing, this applies |
| 177 | to Java, Ruby, PHP). |
| 178 | |
| Roger Meier | 16fcad0 | 2014-03-16 21:12:11 +0100 | [diff] [blame] | 179 | Look for the README.md file in the lib/<language>/ folder for more details on the |
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 180 | installation of each language library package. |
| Carl Yeksigian | e2c5b2d | 2013-06-06 07:24:51 -0400 | [diff] [blame] | 181 | |
| JackBoosY | 829b7d3 | 2020-01-16 00:38:15 -0800 | [diff] [blame] | 182 | Package Managers |
| 183 | ================ |
| 184 | |
| Jiayu Liu | 096a061 | 2022-10-11 11:46:25 +0800 | [diff] [blame] | 185 | Apache Thrift is available via a number of package managers, a list which is |
| 186 | is steadily growing. A more detailed overview can be found |
| 187 | [at the Apache Thrift web site under "Libraries"](http://thrift.apache.org/lib/) |
| PoojaChandak | 20205b8 | 2020-11-06 11:33:40 +0100 | [diff] [blame] | 188 | and/or in the respective READMEs for each language under /lib |
| JackBoosY | 829b7d3 | 2020-01-16 00:38:15 -0800 | [diff] [blame] | 189 | |
| Carl Yeksigian | e2c5b2d | 2013-06-06 07:24:51 -0400 | [diff] [blame] | 190 | Testing |
| 191 | ======= |
| 192 | |
| 193 | There are a large number of client library tests that can all be run |
| 194 | from the top-level directory. |
| 195 | |
| zeshuai007 | 348790d | 2020-03-23 16:48:35 +0800 | [diff] [blame] | 196 | make -k check |
| Carl Yeksigian | e2c5b2d | 2013-06-06 07:24:51 -0400 | [diff] [blame] | 197 | |
| 198 | This will make all of the libraries (as necessary), and run through |
| 199 | the unit tests defined in each of the client libraries. If a single |
| 200 | language fails, the make check will continue on and provide a synopsis |
| 201 | at the end. |
| 202 | |
| 203 | To run the cross-language test suite, please run: |
| 204 | |
| zeshuai007 | 348790d | 2020-03-23 16:48:35 +0800 | [diff] [blame] | 205 | make cross |
| Carl Yeksigian | e2c5b2d | 2013-06-06 07:24:51 -0400 | [diff] [blame] | 206 | |
| 207 | This will run a set of tests that use different language clients and |
| Jens Geyer | 0853ab6 | 2013-12-17 21:38:44 +0100 | [diff] [blame] | 208 | servers. |
| James E. King, III | 254e86b | 2017-10-25 09:02:48 -0400 | [diff] [blame] | 209 | |
| James E. King, III | cfb0130 | 2017-11-11 09:39:19 -0500 | [diff] [blame] | 210 | |