| 30 |
ashish |
1 |
Apache Thrift (an Apache Incubator project)
|
|
|
2 |
|
|
|
3 |
Last Modified: 2009-Jan-30
|
|
|
4 |
|
|
|
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.
|
|
|
24 |
|
|
|
25 |
Introduction
|
|
|
26 |
============
|
|
|
27 |
|
|
|
28 |
Thrift is a lightweight, language-independent software stack with an
|
|
|
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 |
|
|
|
35 |
Thrift is specifically designed to support non-atomic version changes
|
|
|
36 |
across client and server code.
|
|
|
37 |
|
|
|
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
|
|
|
40 |
in your particular subdirectory of interest.
|
|
|
41 |
|
|
|
42 |
Heirarchy
|
|
|
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/
|
|
|
55 |
java/
|
|
|
56 |
php/
|
|
|
57 |
py/
|
|
|
58 |
rb/
|
|
|
59 |
|
|
|
60 |
test/
|
|
|
61 |
|
|
|
62 |
Contains sample Thrift files and test code across the target programming
|
|
|
63 |
languages.
|
|
|
64 |
|
|
|
65 |
tutorial/
|
|
|
66 |
|
|
|
67 |
Contains a basic tutorial that will teach you how to develop software
|
|
|
68 |
using Thrift.
|
|
|
69 |
|
|
|
70 |
Requirements
|
|
|
71 |
============
|
|
|
72 |
|
|
|
73 |
See http://wiki.apache.org/thrift/ThriftRequirements for
|
|
|
74 |
an up-to-date list of build requirements.
|
|
|
75 |
|
|
|
76 |
Resources
|
|
|
77 |
=========
|
|
|
78 |
|
|
|
79 |
More information about Thrift can be obtained on the Thrift webpage at:
|
|
|
80 |
|
|
|
81 |
http://incubator.apache.org/thrift
|
|
|
82 |
|
|
|
83 |
Acknowledgments
|
|
|
84 |
===============
|
|
|
85 |
|
|
|
86 |
Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo,
|
|
|
87 |
and also by Google's protocol buffers.
|
|
|
88 |
|
|
|
89 |
Installation
|
|
|
90 |
============
|
|
|
91 |
|
|
|
92 |
If you are building from the first time out of the source repository, you will
|
|
|
93 |
need to generate the configure scripts. (This is not necessary if you
|
|
|
94 |
downloaded a tarball.) From the top directory, do:
|
|
|
95 |
|
|
|
96 |
./bootstrap.sh
|
|
|
97 |
|
|
|
98 |
Once the configure scripts are generated, thrift can be configured.
|
|
|
99 |
From the top directory, do:
|
|
|
100 |
|
|
|
101 |
./configure
|
|
|
102 |
|
|
|
103 |
You may need to specify the location of the boost files explicitly.
|
|
|
104 |
If you installed boost in /usr/local, you would run configure as follows:
|
|
|
105 |
|
|
|
106 |
./configure --with-boost=/usr/local
|
|
|
107 |
|
|
|
108 |
Note that by default the thrift C++ library is typically built with debugging
|
|
|
109 |
symbols included. If you want to customize these options you should use the
|
|
|
110 |
CXXFLAGS option in configure, as such:
|
|
|
111 |
|
|
|
112 |
./configure CXXFLAGS='-g -O2'
|
|
|
113 |
./configure CFLAGS='-g -O2'
|
|
|
114 |
./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
|
|
|
115 |
|
|
|
116 |
Run ./configure --help to see other configuration options
|
|
|
117 |
|
|
|
118 |
Please be aware that the Python library will ignore the --prefix option
|
|
|
119 |
and just install wherever Python's distutils puts it (usually along
|
|
|
120 |
the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control
|
|
|
121 |
where the Python modules are installed, set the PY_PREFIX variable.
|
|
|
122 |
(DESTDIR is respected for Python and C++.)
|
|
|
123 |
|
|
|
124 |
Make thrift:
|
|
|
125 |
|
|
|
126 |
make
|
|
|
127 |
|
|
|
128 |
From the top directory, become superuser and do:
|
|
|
129 |
|
|
|
130 |
make install
|
|
|
131 |
|
|
|
132 |
Note that some language packages must be installed manually using build tools
|
|
|
133 |
better suited to those languages (at the time of this writing, this applies
|
|
|
134 |
to Java, Ruby, PHP).
|
|
|
135 |
|
|
|
136 |
Look for the README file in the lib/<language>/ folder for more details on the
|
|
|
137 |
installation of each language library package.
|