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