Commit Graph

5140 Commits

Author SHA1 Message Date
zhangkun 712e9c1201 Adds call type to MethodDescriptor as some transports need to know whether
the call is unary or streaming when starting the call.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71867037
2015-01-08 14:42:31 -08:00
ejona f97eb733f7 Add Server API, a.k.a., Channel for incoming requests.
Everything is nested under a single Server class. This may not seem best, but splitting things up basically requires a lot of "Server" prefixes all over the place, even if we use a separate package. I'm expecting to defer the decision, but once we decide the organization we need to update the Channel API to match.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71838718
2015-01-08 14:42:31 -08:00
lukes edee75fa47 Migrate callers of MoreExecutors.sameThreadExecutor() to use either
MoreExecutors.directExecutor() or MoreExecutors.newDirectExecutorService()
based on whether the code requires an Executor or an ExecutorService instance.

This is being done to resolve some performance issues with the current
sameThreadExecutor() implementation, by allowing users who don’t need
ExecutorService#shutdown semantics to not pay for them, and to make the costs
more obvious for users who do need them.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71585920
2015-01-08 14:42:31 -08:00
brettmorgan 56f5ec305e Upgrading OKHTTP to v2.0
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71465711
2015-01-08 14:42:30 -08:00
simonma 77d9706bd3 Add okhttp client transport.
OkHttpSession is temporally kept for server side using.

Test:
java/com/google/net/stubby/testing/integration/grpc_java_server --port=10009 --transport=http2_okhttp

java/com/google/net/stubby/testing/integration/grpc_java_client --serverHost=localhost --serverPort=10009 --transport=http2_okhttp
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71436060
2015-01-08 14:42:30 -08:00
nathanmittler 14af1cb2e8 Extracting out the Netty negotiation logic into a separate utility class.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71357187
2015-01-08 14:42:30 -08:00
zhangkun 1e26ae1924 Fixes GRPC third_party TAP breakage due to naming changes on generated interfaces.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71347520
2015-01-08 14:42:29 -08:00
nathanmittler bf8870ba86 Update GRPC to work with latest Netty version.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71285057
2015-01-08 14:42:29 -08:00
lryan a3f0180290 Add simple context exchange mechanism by wrapping Channel.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71139615
2015-01-08 14:42:29 -08:00
lryan 34650408aa Add ability to bind HTTP style headers to stubs and have them propagate over
transports that can deliver them.

This unblocks sending OAuth2 headers natively
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=71118741
2015-01-08 14:42:29 -08:00
nathanmittler c0a06819b7 Adding simple Transport for HTTP. Also creating abstract base classes for common stream/transport code.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70983246
2015-01-08 14:42:28 -08:00
ejona e7a43e4e38 Workaround error caused by zero-length DATA frames.
The real solution is to not assume gRPC frame/DATA frame alignment, but
that is a much larger piece of work.

The bug was exposed via talking HTTP/2 to GFE which used a separate DATA frame
for closing the stream.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70982223
2015-01-08 14:42:28 -08:00
nathanmittler cc7cdb1ab4 Implementing Netty-based GRPC Client Transport. Server-side will be implemented in a follow-up CL.
Overview:
- NettyClientTransport - this is the entry point into the client transport. This creates streams as well as the NettyClientHandler

- NettyClientStream - client stream implementation. This sends commands to the NettyClientHandler via commands.  Callbacks on the stream are made directly from the NettyClientHandler in the channel thread context.

- NettyClientHandler - A Netty HTTP/2 handler that acts as a bridge between the NettyClientStreams and Netty's HTTP/2 processing.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70970028
2015-01-08 14:42:28 -08:00
lryan 0359907f61 Add NPN/ALPN support via Jetty extensions
Resurrect integration tests that pass through GFE for HTTP2+Netty
Misc improvements to hexa environment

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70683236
2015-01-08 14:42:27 -08:00
nathanmittler ad1ee03104 Clarifying the InputStream ownership contract in Call.Listener and StreamListener.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70334261
2015-01-08 14:42:27 -08:00
nathanmittler 46fea97a63 Some minor cleanup on the transport API (documentation and such).
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70109458
2015-01-08 14:42:27 -08:00
nathanmittler 05a2b252ba New Buffer type for transport API.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70056282
2015-01-08 14:42:26 -08:00
nathanmittler f4694f57f9 A couple minor fixes to Channel for bugs exposed while integration testing with Netty transport.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69939586
2015-01-08 14:42:26 -08:00
simonma 6933667178 Sync with new error code.
And when write the Code in the MessageFramer, write the field number instead of the index.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69868712
2015-01-08 14:42:26 -08:00
nathanmittler 56c1d8c245 Fixing gRPC code to work with new Netty jar
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69768756
2015-01-08 14:42:25 -08:00
ejona cc9ca9620e Update message framing IDs to adhere to gRPC spec
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69657434
2015-01-08 14:42:25 -08:00
ejona 7f23d5ccac Copy framing classes to newtransport, tweaking some of their APIs
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69489753
2015-01-08 14:42:25 -08:00
ejona c638f958fc Port client tests to newtransport.
Where possible, I tried to cleanly shutdown the Channel.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69404518
2015-01-08 14:42:25 -08:00
ejona 82c87abcbf Fix bugs exposed by test_TestServiceBenchmarks.
More bugs were lurking in this section of code. In some unknown way,
code I'm working on triggered frequent (9/10) failures of
test_TestServiceBenchmarks. These were all possible to be triggered on
HEAD, but for some unknown reason are not.

I am pretty certain we have at least one transport that handles
exceptions poorly, such as by throwing away the exception and not
informing the Operation of the error, which causes this test to time out.
Timeouts in this test are thus likely an indicator of a real bug, even
when it doesn't show any exception, because there was likely an exception
and it was eaten without logging.

Bugs fixed (in order of discovery):

1) In Deframer, currentLength and inFrame were not reset after
consuming a context or status message.

2) In consolidate(), if suffix was greater than the buffer and the
buffer contained data, the data would be lost.

3) In Deframer, some (unknown) Operation's addPayload() did not consume
all of the provided InputStream immediately (maybe it does so on
another thread), leaving those bytes in frame.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69402916
2015-01-08 14:42:24 -08:00
ejona 88a758236a Deframer.deframe returns number of unprocessed bytes.
This is intended to reduce the flakiness of test_TestServiceBenchmarks.
TAP showed some flaky runs where HttpStreamDeframer threw the exception
"GRPC stream not correctly aligned".

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69166650
2015-01-08 14:42:24 -08:00
nathanmittler 9334b6fa32 Adding first-cut at generic Netty client and servers implementing the Service interface.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69076530
2015-01-08 14:42:24 -08:00
ejona 4d642200e7 [2/2] Swap Operation wrapping from Channel to Transport.
Session is now (properly) implementing transport API, so ChannelImpl has some
testing.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69074094
2015-01-08 14:42:23 -08:00
ejona 4fd4845481 Remove fluent-style from newtransport Stream.
The fluent-style wasn't being used, yet made it impossible to
simultaneously implement both ClientStream and ServerStream. Having a
single class that switches between client and server behavior based on a
boolean is helpful to some transports.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69028356
2015-01-08 14:42:23 -08:00
ejona 5e01cea1ef Change newtransport to use c.g.n.stubby.Status.
c.g.n.stubby.Transport.Status isn't intended to be used (at least at
this point).
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69027874
2015-01-08 14:42:23 -08:00
ejona 35cabd0b82 [1/2] Split Channel and Stub APIs, implement Channel.
Call does not accept InputStream length because Marshaller makes it too hard
for the Stub to determine the length.

SessionCall is updated to implement changes to Call, but it is replaced in the
next CL.

You can see what glue is necessary to join the Transport and Stub APIs. The
ugliest pain is dealing with flow control callback. Some of that code is
unrelated and necessary because the Channel uses a separate thread to run
Call.Listener. Other parts will be necessary because Channel must intervene
during Transport callbacks to handle retry logic.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69020275
2015-01-08 14:42:23 -08:00
lryan 0cf7d4c353 Bring netty5 up to head to support HTTP2 draft 12 so we can test with GFE
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=69006100
2015-01-08 14:42:22 -08:00
nathanmittler d784765814 Updating the transport Stream API to allow for callbacks for when a message was accepted by flow control.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=68706844
2015-01-08 14:42:22 -08:00
ejona 2af35d9bd3 Improve JavaDoc, including style fixes
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=68555036
2015-01-08 14:42:22 -08:00
lryan f8bbc12468 Remove SPDY support from GRPC
Will re-create the E2E tests through GFE when we can properly initiate HTTP2 with GFE.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=68488736
2015-01-08 14:42:21 -08:00
nathanmittler ef31a5f2ae First cut at the GRPC Transport interfaces for Java.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=68458345
2015-01-08 14:42:21 -08:00
ejona 8be938ee25 Move newstub to third_party and rename to stub.
It was an oversight that newstub was not in third_party when committed.

Renaming of package was preformed via a script.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=68416211
2015-01-08 14:42:20 -08:00
lryan 2ce8446a0d Large refactor to:
- Introduce 'Channel' & 'Call' interfaces
- Unify the surfaces for the prototype generated stubs
- Lighten dependency on MessageLite outside of generated code (see Marshaller)
- Bridge Channel to Session pending Transport interface rewrite
- Update all tests to new interfaces

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=68407406
2015-01-08 14:42:20 -08:00
zhangkun 347a22dde0 Add toString() to Status.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=67721763
2015-01-08 14:42:20 -08:00
ejona 07d3f6a202 Move gRPC core to third_party
Half our tests still need to be moved, but that will be for a later
time.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=67023748
2015-01-08 14:42:19 -08:00
ejona de5413f6c2 Initial commit 2015-01-08 14:42:02 -08:00