Commit Graph

763 Commits

Author SHA1 Message Date
Mark Slee
6756f1351a Getters for input/output protocol in client lib
Summary: Why not, nice to have. From Ted Dziuba.

Reviewed By: dreiss

Test Plan: Build Java compiler.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665471 13f79535-47bb-0310-9956-ffa450edef68
2008-02-09 00:26:29 +00:00
Mark Slee
22360b2f30 Use interfaces, not classes for Java gen
Summary: Not AbstractMap or HashSet, etc. use Map, List, Set

Reviewed By: dreiss

Test Plan: Generate Java code and build java tests

Other Notes: Submitted by Seth Falcon


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665470 13f79535-47bb-0310-9956-ffa450edef68
2008-02-09 00:18:32 +00:00
Mark Slee
a8de4895f6 Patch from Ross McFarland to compile with strict warnings
Summary: Use comment trick in params that are unused to prevent warnings

Reviewed By: dreiss

Test Plan: Generate C++ code and compile -W -Wall


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665469 13f79535-47bb-0310-9956-ffa450edef68
2008-02-09 00:02:26 +00:00
David Reiss
3c5d2fd9a8 Thrift: Fix a bug in local reflection generation.
Summary:
The problem was that in generate_local_reflection, we refused to
generate reflections for types defined in another program, including enums.
But in local_reflection_name, we treated enums like base types,
assuming that their reflections were always defined in this program.
One solution would be to treat enums like base types everywhere, and always
generate their reflections in the program where they were being used.
But this change takes the opposite approach.  We now always
generate fingerprints for enums in the program in which they are defined,
even if they are not used there.

Reviewed By: mcslee

Test Plan:
Got the following files to build and link correctly with -dense.

dreiss@dreiss-vmware:reflection:thrift/test$ tail test[12].thrift
==> test1.thrift <==
enum foo { bar }

==> test2.thrift <==
include "test1.thrift"
struct baz {
  1: test1.foo qux
}

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665468 13f79535-47bb-0310-9956-ffa450edef68
2008-02-08 21:58:06 +00:00
David Reiss
0c90f6f8af Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.

Reviewed By: mcslee

Test Plan: git diff -b

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:18:40 +00:00
David Reiss
3160971286 Thrift: Update some makefiles to make "make dist" work.
Reviewed By: mcslee

Test Plan: Ran "make dist" and did a diff.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665466 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:10:26 +00:00
David Reiss
1fdb59242a Thrift: Add a Makefile to build the C# library with Mono.
Reviewed By: mcslee

Test Plan: Installed Mono and built it.

Revert Plan: ok

Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665465 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:10:12 +00:00
David Reiss
46dc62950d Thrift: Miscellaneous optimizations for C#.
Reviewed By: mcslee

Test Plan: Built it after a future revision.

Revert Plan: ok

Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665464 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:09:58 +00:00
David Reiss
cba5727a3f Thrift: String/Binary distinction for C#.
Reviewed By: mcslee

Test Plan: Built it after a future revision.

Revert Plan: ok

Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665463 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:09:44 +00:00
David Reiss
e4667378c4 Thrift/Ruby: Bug fix.
Summary:
Some member variables were actually being treated as local variables.

Reviewed By: mcslee

Test Plan: None.

Revert Plan: ok

Other Notes:
Actually reviewed by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665462 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 18:22:39 +00:00
David Reiss
f7baf549bc Thrift: Revamp TMemoryBuffer constructors.
Summary:
There were some weird cases where the implicit conversion from
const char* to std::string was causing the wrong constructor to be called.
There wasn't really a clean workaround, so we're dropping the string
constructors.

Reviewed By: mcslee

Test Plan:
Ran the test.
Grepped around the /projects tree for uses that had to fixed,
and fixed them.

Revert Plan: ok

Other Notes:
This risk was pointed out by Ben Maurer.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665461 13f79535-47bb-0310-9956-ffa450edef68
2008-02-04 21:56:27 +00:00
Mark Slee
adb5cad7d3 Make inner Isset classes implement serializable
Summary: Since the outer class is serializable, you'll want it on the inner member too. Though in general you shouldn't be using Java to serialize Thrift objects, as that misses the point and tosses version compatibility out the window.

Reviewed By: dreiss

Test Plan: Generate Java code


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665460 13f79535-47bb-0310-9956-ffa450edef68
2008-02-04 21:34:22 +00:00
David Reiss
e6ec4141a8 Thrift: Update CONTRIBUTORS.
Summary:
Forgot to mention in my last commit that the bulk of the change was
submitted by Nitay.  Updating the CONTRIBUTORS file while I'm at it.

Reviewed By: mcslee

Test Plan: None.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665459 13f79535-47bb-0310-9956-ffa450edef68
2008-02-04 21:28:20 +00:00
David Reiss
8180c0c028 Thrift: "make check" support.
Summary:
Add a Makefile.am in the test directory that runs some of the test programs
when "make check" is executed.  Also removed some obsolete comments.

Reviewed By: mcslee

Test Plan:
Ran make check, saw all tests pass.
Ran make install, saw no test programs installed.
Ran ./cleanup.sh, saw a pristine workspace.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665458 13f79535-47bb-0310-9956-ffa450edef68
2008-02-04 21:14:14 +00:00
David Reiss
20f009d625 Thrift: Forgot to dereference a pointer.
Summary:
This didn't get updated when the interface changed,
and the cast silenced the warning message.  Stupid C.

Reviewed By: mcslee

Test Plan: Trust Chad Walters.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665457 13f79535-47bb-0310-9956-ffa450edef68
2008-02-04 19:24:00 +00:00
David Reiss
4637990013 Thrift: Fix a bug in a test program.
Summary:
This didn't get updated when the class was renamed.

Reviewed By: mcslee

Test Plan: Trust Chad Walters.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665456 13f79535-47bb-0310-9956-ffa450edef68
2008-02-04 19:23:57 +00:00
David Reiss
f495f367c9 Thrift: Make borrow (almost) always succeed for TBufferedTransport.
Chad Walters is writing a JSON protocol for Thrift, but he wants
borrow to always succeed.  That would be a pain to implement,
but here is a first step: borrow will almost always work with
TBufferedTransport.

Reviewed by: mcslee

Test Plan: Ran the DenseProtocol test and Zlib test, but more needs to be done.

Other Notes:
Also reviewed by Chad Walters, and maybe Ben Maurer.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665455 13f79535-47bb-0310-9956-ffa450edef68
2008-02-02 00:54:55 +00:00
David Reiss
d46eb09bef Thrift: Update the interface for TTransport's "borrow" method.
Summary:
I don't know what I was thinking when I first wrote this.
It makes sense that the transport might not want to allocate its own memory,
so the protocol is expected to provide a buffer for the data.
However, if the transport already has the data buffered,
there is no need to memcpy it; it can just return a pointer into its buffer.
The new interface still requires the protocol to provide a buffer,
but allows the transport to return a pointer to an interal buffer.
In addition, I made len a pass-by-pointer parameter so that
the transport can return more than the requested data if it has it
available in its buffers.

Reviewed By: mcslee

Test Plan: Ran the DenseProtocol test and the Zlib test.

Revert Plan: ok

Other Notes:
Also got this reviewed by Chad Walters from Powerset.
Ben Maurer suggested making len a reference parameter.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665454 13f79535-47bb-0310-9956-ffa450edef68
2008-02-02 00:54:48 +00:00
dweatherford
84e5022bfc [thrift] Fix generated T_LIST push_back() for cpptype override
Summary: Thrift compiler emitting code missing a closing paren:
  "this->extras.push_back(_elem18;"
Reviewed by: eletuchy
Test plan: rebuild some feed code that uses cpptype overrides
Revert: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665453 13f79535-47bb-0310-9956-ffa450edef68
2008-02-01 20:42:56 +00:00
Mark Slee
f07d48e812 Fix to the throws clause validation
Summary: Types from external files are not resolved until the program parse pass, not the include one. Therefore, only do full type validation once after all includes have been parsed and external type pointers resolved.

Reviewed By: aditya

Test Plan: build ServiceManager.thrift


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665452 13f79535-47bb-0310-9956-ffa450edef68
2008-02-01 01:36:26 +00:00
Mark Slee
5cf89c1610 If a list has a custom CPP type, use push_back
Summary: Can't deserialize by reference into std::list, for example

Reviewed By: dweatherford

Test Plan: Build feed


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665451 13f79535-47bb-0310-9956-ffa450edef68
2008-01-31 22:02:26 +00:00
Mark Slee
91f2b7b2f7 Validate that throws clauses in Thrift contain only exceptions
Summary: Throwing non-exceptions, though allowed in some languages, is a weird concept and causes problems in many places. Disallow it in the Thrift compiler and throw an informative error.

Reviewed By: dreiss

Test Plan: Generate a file with an int or something in a throws clause. Peep the nice informative compiler error.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665450 13f79535-47bb-0310-9956-ffa450edef68
2008-01-31 01:49:16 +00:00
Mark Slee
8d4b1cc3ab Improve C++ vector deserialization
Summary: Use std::vector::resize() method to default construct placeholder elements. Then grab references via operator[] to deserialize directly into the vector, instead of copy-constructing elements in.

Reviewed By: hzhao

Test Plan: test/cpp contains list serialization/deserialization checks


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665449 13f79535-47bb-0310-9956-ffa450edef68
2008-01-31 00:06:29 +00:00
Mark Slee
61959f5d9d Improve Thrift map deserialization code
Summary: Instead of copy-constructing map values into the map, alter the code such that we insert default-constructed elements into the map and then deserialize them by reference.

Reviewed By: hzhao

Test Plan: Ran the test in test/cpp which include serialization and deserialization of nested maps.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665448 13f79535-47bb-0310-9956-ffa450edef68
2008-01-30 23:23:15 +00:00
Christopher Piro
aa93451dbf [thrift] iolists and binaries in Erlang
Summary: three related changes:
 * for numeric types in tBinaryProtocol call effectful_write with binary(), not [char()]
 * tBinaryProtocol:writeString now takes either [char()], iolist(), or binary() ... now you can use any of the three where a Thrift string is required
 * tBufferedTransport now buffers by building an iolist() rather than Buffer++Data.  zomg.

Reviewed By: eletuchy

Test Plan: everything seems to work as usual, and binary() works as expected

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665447 13f79535-47bb-0310-9956-ffa450edef68
2008-01-30 01:39:01 +00:00
David Reiss
073e2cfeb5 Thrift/Ruby: Generate nicer constructors for Thrift structs.
Submitted by William Morgan.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665446 13f79535-47bb-0310-9956-ffa450edef68
2008-01-28 20:47:00 +00:00
David Reiss
3e6583365a Thrift/Ruby: Allow some thrift exceptions to use standard Ruby syntax.
Submitted by William Morgan.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665445 13f79535-47bb-0310-9956-ffa450edef68
2008-01-28 20:46:57 +00:00
David Reiss
f09b8a01b1 Thrift/Ruby: TSimpleServer closes its listen socket on an uncaught exception.
Submitted by William Morgan.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665444 13f79535-47bb-0310-9956-ffa450edef68
2008-01-28 20:46:53 +00:00
David Reiss
fe6d1488eb Thrift/Ruby: Remove a debugging message.
Submitted by William Morgan.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665443 13f79535-47bb-0310-9956-ffa450edef68
2008-01-28 20:46:50 +00:00
David Reiss
41911a5166 Thrift: Better exception handling in Ruby.
Reviewed By: mcslee

Test Plan: None.

Revert Plan: ok

Other Notes:
Submitted by William Morgan.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665442 13f79535-47bb-0310-9956-ffa450edef68
2008-01-25 20:12:26 +00:00
David Reiss
0e87ef7ae7 Thrift: Some sort of Ruby performance fix.
Reviewed By: mcslee

Test Plan: None.

Revert Plan: ok

Other Notes:
Submitted by Dave Simpson.
Approved by Kevin Clark.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665441 13f79535-47bb-0310-9956-ffa450edef68
2008-01-25 20:05:50 +00:00
David Reiss
b0232b39e3 Thrift: Allow a custom User-Agent with the Cocoa THttpClient.
Reviewed By: mcslee

Test Plan: None.

Other Notes:
Submitted by Andrew McGeachie, the author of the Cocoa bindings.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665440 13f79535-47bb-0310-9956-ffa450edef68
2008-01-23 20:35:39 +00:00
Mark Slee
1e150185da Thrift CSharp build to check compiler return code
Summary: If non-zero, toss an error to the log

Reviewed By: dreiss

Other Notes: Submitted by Will Palmeri


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665439 13f79535-47bb-0310-9956-ffa450edef68
2008-01-22 04:04:30 +00:00
Christopher Piro
a9a4d481e0 [thrift] Ruby TThreadedServer and TThreadPoolServer
Summary: They both use the same handler for all connections and thus assume the handler is thread-safe. The TThreadPoolServer preserves threads, so it wouldn't be too hard to make a variant that used a separate handler for each thread and thus didn't require thread safety.

Reviewed By: mcslee

Test Plan: loads without error

Revert Plan: ok

Other Notes: contributed by William Morgan (w@adap.tv)


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665438 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 21:35:34 +00:00
David Reiss
050f3200a2 Thrift: Change the way constants are initialized to avoid segfaults.
Reviewed By: mcslee

Test Plan: Looked at the patch carefully.

Other Notes:
Patch submitted by Dave Simpson.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665437 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 07:39:36 +00:00
mvaradachari
5b3cbd13d6 test trigger
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665436 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 01:54:55 +00:00
mvaradachari
b216c03229 test triggers
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665435 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 01:00:18 +00:00
Mark Slee
32007a555c Fix set_name compiler method signature
Reviewed By: kholst

Other Notes: Follow up from 78130


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665434 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 00:57:59 +00:00
Mark Slee
4b3381314f Fix typo of current
Summary: Whoops.

Reviewed By: dreiss

Other Notes: Submitted by Patrick Collison


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665433 13f79535-47bb-0310-9956-ffa450edef68
2008-01-16 21:29:45 +00:00
David Reiss
225f8b0d51 Thrift: Improve cleanup.sh.
Reviewed By: mcslee

Test Plan:
dreiss@dreiss-vmware:cleanup:thrift$ ./bootstrap.sh && ./configure && make -j2 && ./cleanup.sh && git status
# Shows no untracked files.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665432 13f79535-47bb-0310-9956-ffa450edef68
2008-01-16 06:32:19 +00:00
kholst
76f2c88eda thrift: Add -cpp_use_include_prefix flag to compiler
Summary: Adds a new flag to allow for a mode where #include statements in generated c++ will include path context information.  For example, if my .thrift file includes "foo/bar/baz.thrift", the generated source files will contain #include statements like:

         #include "foo/bar/gen-cpp/baz_types.h"

         instead of just:

         #include "baz_types.h"

         -cpp_use_include_prefix is OFF by default.

Reviewed By: dreiss

Test Plan: Tested against multiple thrift input files both with and without the new flag.

Revert: OK

DiffCamp Revision: 5522


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665431 13f79535-47bb-0310-9956-ffa450edef68
2008-01-16 02:47:41 +00:00
Mark Slee
2e8a8d4095 Make sure exceptinos in servers are caught
Summary: There was potential for a write exception in close() because it might call flush() internally

Reviewed By: dreiss


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665430 13f79535-47bb-0310-9956-ffa450edef68
2008-01-16 00:38:20 +00:00
David Reiss
1c99140ec0 Thrift: Fix formatting of the CONTRIBUTORS file.
Reviewed By: mcslee

Test Plan: no

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665429 13f79535-47bb-0310-9956-ffa450edef68
2008-01-15 19:45:02 +00:00
Christopher Piro
3f1d8c7cf6 [thrift] flesh out thrift Erlang tutorial client
Summary: Added examples for all examples except inheritance and application exception handling (divide by zero); looks like both are currently broken.  Weak.

Reviewed By: eletuchy

Test Plan: works just like RubyClient.rb (modulo the commented out bits)

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665428 13f79535-47bb-0310-9956-ffa450edef68
2008-01-15 12:52:51 +00:00
Christopher Piro
8ba81573b3 [thrift] preliminary tthrift tutorial client for Erlang
Summary: we haven't had a client tutorial for the longest time -- added one that basically works.  will iron the bugs out in due order.

Reviewed By: eletuchy

Test Plan: works when launched like server.sh

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665427 13f79535-47bb-0310-9956-ffa450edef68
2008-01-15 12:04:15 +00:00
Christopher Piro
5165f3e65e [thrift] add a configuration file to the Erlang server tutorial
Summary: Logger configuration (and all Thrift config in Erlang) now uses application:get_env/2 via thrift:config/2.  Defaults can be provided on the erl command line with ``-config <filename>''.  It may also be helpful to cascade config files; {key, value} pairs provided in subsequent files will override previous ones -- e.g. in our applications we use ``-config base.config -config cpiro.config''.

server.config was added as an example and server.sh was updated to invoke erl with ``-config server.config''.

Reviewed By: eletuchy

Test Plan: the tutorial server now outputs a reasonable set of messages

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665426 13f79535-47bb-0310-9956-ffa450edef68
2008-01-15 12:04:12 +00:00
Christopher Piro
8ca66b8805 [thrift] update thrift_logger bits in Erlang server tutorial
Summary: thrift_logger changed a while back but the tutorial didn't keep up.  fixed.

Reviewed By: eletuchy

Test Plan: compiles now :p

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665425 13f79535-47bb-0310-9956-ffa450edef68
2008-01-15 12:04:09 +00:00
Mark Slee
737ce021d1 Add some more TThreadPoolServer constructors
Summary: Change the default to Executors.newCachedThreadPool() which is a good default and basically what we should always want.

Reviewed By: dreiss

Test Plan: Run a Java server with default args


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665424 13f79535-47bb-0310-9956-ffa450edef68
2008-01-15 02:59:12 +00:00
Mark Slee
1c4ced7409 Generate structs/exceptions in declared order
Summary: Otherwise you're liable to get forward declaration problems in the generated C++ code.

Reviewed By: dreiss

Test Plan: Generate some code that mixes exceptions/structs and has methods potentially return a list of exceptions


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665423 13f79535-47bb-0310-9956-ffa450edef68
2008-01-14 23:04:43 +00:00
Christopher Piro
21db52de16 [thrift] fix thrift_logger.erl when show_pid option is enabled
Summary: this gets rid of a lot of messy useless output every time the error logger prints something

Reviewed By: eletuchy

Test Plan: works as expected

Revert Plan: ok

Other Notes: contributed by Todd Lipcon (todd@amiestreet.com)


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665422 13f79535-47bb-0310-9956-ffa450edef68
2008-01-14 05:54:50 +00:00