Summary:
Previously, Thrift used the name of the .thrift file as the python module name.
This wasn't very flexible. Now the python module can be explicitly declared.
Also, there was no need for t_py_generator to inherit from t_oop_generator.
Reviewed By: mcslee
Test Plan:
cd test/py/explicit_module
./runtest.sh
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665234 13f79535-47bb-0310-9956-ffa450edef68
Summary:
It seems like the Python convention is that random janky libraries
are installed in /usr/lib/pythonX.Y/site-packages. This patch follows
that convention, even though it is pretty gross to ignore --prefix.
Reviewed By: mcslee
Test Plan: make install thrift python libs on my box.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665233 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Building fb303 is hard enough without including limited reflection.
This change will install reflection_limited.thrift into /usr/share/thrift/if
so it will be easier for fb303 to find (we won't have to dig it out of the
thrift source directory).
Reviewed By: mcslee, marc
Test Plan:
./bootstrap.sh && ./configure && make && sudo make install
(on my vmware box).
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665230 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The fingerprint code was generating invalid C++ code.
Blame Rev: 57192
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Thrifted DebugProtoTest with new compiler.
Compiled and rand DebugProtoTest.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665229 13f79535-47bb-0310-9956-ffa450edef68
Summary:
We are going to write a dense protocol soon that eliminates some metadata.
To prevent version conflicts, we want each structure to have a
structural fingerprint that will change whenever the struct changes
in a way that will affect the dense protocol.
This change computes those fingerprints and puts them in
the generated C++ code.
Reviewed By: aditya, mcslee
Test Plan:
Recompiled thrift.
Thrifted DebugProtoTest with old and new compilers.
Compared output.
Also ran thrift with those "cout"s uncommented,
examined the fingerprint material,
and verified the hashes.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665227 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The Thrift compiler now generates static methods for every service to generate
a reflection of the methods provided by the service. This reflection is fairly
limited, but should be enough for what we want to do with SMC.
Reviewed By: mcslee
Test Plan: test/ReflectionTest.cpp
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665226 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The recently committed fastbinary.c doesn't compile with Python 2.4.
This version does.
Blame Rev: 56816
Reviewed By: mcslee
Test Plan: make install on devrs004
Revert Plan: Do 56816 also.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665225 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Merging a patch from Ben Maurer.
This adds a python extension (i.e., a C module) that
encodes Python thrift structs into the standard binary protocol
much faster than our generated Python code.
Also added by-value equality comparison to thrift structs
(to help with testing).
Cleaned up some trailing whitespace too.
Reviewed By: mcslee, dreiss
Test Plan:
Recompiled Thrift.
Thrifted a bunch of IDLs and compared the generated Python output.
Looked at the extension module a lot.
test/FastBinaryTest.py
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665224 13f79535-47bb-0310-9956-ffa450edef68
Summary:
We added a helper function for the generators: get_true_type,
which finds the actual type behind a series of typedefs
(though the compiler only supports one layer of typedefs now).
This change uses it everywhere we used to have that loop.
(It was a lot of places.)
Reviewed By: mcslee
Test Plan: test/ManyTypedefs.thrift
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665220 13f79535-47bb-0310-9956-ffa450edef68
(This change was by Adam, diff sent by email, I'm just checking it in.)
Blame Rev: 55988
Reviewed By: adam
Test Plan: Thrift compiles.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665219 13f79535-47bb-0310-9956-ffa450edef68
Summary:
using namespace XXX; is tricky because it imports a lot of crap into your namespace.
Also, if we ever decide to remove boost as a dependency, "using namespace boost"
makes it harder.
This patch removes all using namesapce XXX; with one or more using XXX::YYY;
There are some exceptions, such as test, tutorial, namespace std, and
facebook namespaces.
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
grep --binary-files=without-match -r 'using namespace' . | \
egrep -v '^[^:]*: *using namespace (std;$|facebook)' | \
grep -v '<< endl' | \
grep -v '[^:]*/tutorial/' | \
grep -v '^./test/'
Revert Plan: ok
Notes: I wouldn't bother, but it is fixathon.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665218 13f79535-47bb-0310-9956-ffa450edef68
Summary: If using TNonBlockingServer with a ThreadManager, when you send a task off to the threadmanager you need to cancel the event that you have set on that client socket. Otherwise, when you give control back to libevent, it might trigger more read events if there are more requests coming down the pipe. This is an issue, because the server will be in the wrong state at that point and will have no way of handling reading more data if it is still in the WAIT_TASK state trying to see if it should write something back to the client. So, when we hit that control flow, we must setIdle() on the TConnection so that libevent doesn't trigger it anymore. Later, after the result is written, we'll setRead() and go back to the init state.
Reviewed By: akhil
Test Plan: Akhil's async + TNonBlocking karma server
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665217 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Boz is using TMemoryBuffer by constructing it will a NULL buffer,
then doing a resetBuffer later. This patch re-enables that.
Blame Rev: 55988
Reviewed By: aditya
Test Plan:
Thrift compiles.
Will test feed after this is comitted.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665216 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Someone thought it would be a good idea to have two different signatures
for strerror_r, with subtly different semantics (strlcpy = smart).
We now work properly with either of them.
Also fixed a test to work on 32-bit, you sloppy <expletive>s.
Reviewed By: mcslee
Test Plan:
Rebuild thrift.
Force one of these errors to be thrown.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665215 13f79535-47bb-0310-9956-ffa450edef68
Summary:
TMemoryBuffer already has the necessary plubming to work with C++ strings.
This revision implements that functionality with a few wrapper methods.
Removed TStringBuffer as it should no longer be required (and it is tricky
to safely inherit from a class that has a non-virtual destructor).
Also refactored the TMemoryBuffer constructors a bit.
Reviewed By: aditya, yunfang
Test Plan:
test/TMemoryBufferTest.cpp
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665213 13f79535-47bb-0310-9956-ffa450edef68
Summary: reinterpret_cast actually breaks on linux, despite working on FreeBSD
Reviewed By: dreiss
Test Plan: Compile on Linux OR FreeBSD
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665211 13f79535-47bb-0310-9956-ffa450edef68
Summary:
/**
* A string buffer is a tranpsort that simply reads from and writes to a
* string. Anytime you call write on it, the data is serialized
* into the underlying buffer, you can call getString() to get the serialized
* string. Before you call read, you should call resetString(data) to set the
* underlying buffer, you can then call read to get the
* de-serialized data structure.
*
* The string buffer is inherited from the memory buffer
* Thus, buffers are allocated using C constructs malloc,realloc, and the size
* doubles as necessary.
*/
Reviewed by: aditya
Test Plan:
int main(int argc, char** argv) {
shared_ptr<TStringBuffer> strBuffer(new TStringBuffer());
shared_ptr<TBinaryProtocol> binaryProtcol(new TBinaryProtocol(strBuffer));
testStruct a;
a.i1 = 10;
a.i2 = 30;
a.s1 = string("holla back a");
a.write(binaryProtcol.get());
string serialized = strBuffer->getString();
shared_ptr<TStringBuffer> strBuffer2(new TStringBuffer());
shared_ptr<TBinaryProtocol> binaryProtcol2(new TBinaryProtocol(strBuffer2));
strBuffer2->resetString(serialized);
testStruct a2;
a2.read(binaryProtcol2.get());
if (a == a2) {
printf("serialization working\n");
} else {
printf("serialization not working\n");
}
}
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665209 13f79535-47bb-0310-9956-ffa450edef68
Summary: I hate Perl the most. Submitted by Jake Luciani.
Reviewed By: mcslee
Test Plan: We don't even use the Perl bindings for Thrift, but we could use Jake's test scripts on this.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665207 13f79535-47bb-0310-9956-ffa450edef68
Summary: add trylock support to the Mutex class
Reviewed By: mcslee
Test Plan: added trylock mutexes to foreman, walked through them in gdb
(behaved correctly) and then ran an entire sweep (behaved correctly)
Notes: slee ftw
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665204 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Add a function to t_generator to traverse the typedef chain.
Reviewed By: mcslee
Test Plan:
Rebuilt thrift.
Re-thrifted ThriftTest.thrift.
Saw that the output was unchanged.
Revert Plan: ok
Notes:
Converting all of the generators to use this will happen later.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665203 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Merging a patch from Andy Lutomirsky.
- Allow fields to be marked "required" or "optional" (only affects C++).
- Thrift structs now have operator ==.
Reviewed By: mcslee
Test Plan: test/OptionalRequiredTest.cpp
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665202 13f79535-47bb-0310-9956-ffa450edef68
Summary:
It was a bad idea to let doxygen comments become a part of the parse tree.
We now get them a totally different way. The lexer stashes the docsting
contents in a global, and the parser actions (not the rules) pull it out.
This should prevent doxygen comments from ever causing parse errors.
Blame Rev: 52678, 52732
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Thrifted a bunch of files and saw no parse errors (or C++ compile errors).
Thrifted DocTest.thrift with dump_docs on.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665201 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Allow constants to be documented.
Now any "Definition" can be documented, so we can move the docstring stuff
up to a a higher node in the parse tree.
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Checked out DocTest.thrift and a few other thrifts.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665200 13f79535-47bb-0310-9956-ffa450edef68
Summary: all tTEs were being filtered from the logs; now just tTEs that come from connections closing are suppressed
Test Plan: logs my bug in channel server :)
Notes: adds logic to thrift_logger, not removes (bad news bears)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665199 13f79535-47bb-0310-9956-ffa450edef68
Summary: Because we're all about strict aliasing rules in the g++, m'holmbie.
Reviewed By: aditya
Test Plan: Should be NO compiler warnings about (enum&) -> (int32_t&) typecasting
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665196 13f79535-47bb-0310-9956-ffa450edef68
Summary: The library now provides servers that are general like the other languages.
Reviewed by: mcslee
Test plan: Yes
Revert plan: yes
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665195 13f79535-47bb-0310-9956-ffa450edef68
Summary:
thrift.vim has not been deleting its HiLink command.
This causes you to get a (recoverable) error every time you
open a C++ or PHP file after opening a thrift file.
This change deletes the HiLink command, preventing this error.
Reviewed By: martin
Test Plan:
Opened a thrift file, then opened a C++ file in the same session.
Both were highlighted properly.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665194 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Make enum constants as structure defaults work.
Make enum constants as constant map keys work.
Un-break the generated skeleton servers.
Reviewed By: mcslee
Test Plan:
cd test
../compiler/cpp/thrift -cpp ConstantsDemo.thrift
g++ -I../lib/cpp/src -c gen-cpp/*.cpp
Also compared the generated output to the old generated output.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665193 13f79535-47bb-0310-9956-ffa450edef68
Summary:
By "improved", I mean that I added a totally awesome self-referential joke
to one of the test cases. Seriously. In a few years someone is going to
add UTF-8 support to the Debug Protocol and run this test case on a terminal
with really good fonts and they are going to die laughing. Seriously, die.
Trac Bug: #
Blame Rev:
Reviewed By: mcslee
Test Plan:
Recompiled everything and ran the test.
Revert Plan:
Take a good, long look in the mirror, then svn revert.
Notes:
I am awesome.
EImportant:
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665191 13f79535-47bb-0310-9956-ffa450edef68
Summary: generate an error message at the server ... before only the client got the error
Reviewed By: iproctor
Test Plan: tutorial, channel server
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665187 13f79535-47bb-0310-9956-ffa450edef68
Summary:
* custom, extensible error logger -- show only relevant stuff
* clean up of errors in developer-supplied handler module
now gives sane error messages and doesn't crash whole server
(introduces tApplicationException_HANDLER_ERROR)
* more precise catch in tErlProcessor (exits gracefully only if
transport closes)
Reviewed By: iproctor
Test Plan: tutorial works
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665186 13f79535-47bb-0310-9956-ffa450edef68