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