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