Commit Graph

154 Commits

Author SHA1 Message Date
Eric Anderson ada32b0cb1 Optimize number of DATA frames for unary requests
Resolves #10
2015-01-22 16:45:20 -08:00
nmittler de3a13164f Changing gRPC Java inbound flow control model
The goal is to mirror the token-based approach used by the Reactive
Streams API.
2015-01-22 11:46:16 -08:00
ejona 4de2026492 Fix TODO attribution
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84172357
2015-01-16 16:23:05 -08:00
simonma f589a4acbb Remove traces of gRPC v1 protocol vs gRPC v2 protocol.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84087425
2015-01-16 11:03:38 -08:00
ejona 7235a396b8 Remove Service API from ChannelImpl
This change loses asynchronous notification of channel state-change and
a way to wait until the channel is actually connected. Both of these are
expected to be added back as part of a health API. The important
distinction from Service is that ChannelImpl never permanently fails and
can revert from being started to connecting again.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83875407
2015-01-15 13:42:49 -08:00
ejona 198a756b83 Add toString to Headers and Trailers
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83856622
2015-01-15 13:42:46 -08:00
simonma 828f941e99 Remove dependency on guava Lists for initializing list.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83808289
2015-01-15 13:42:43 -08:00
ejona 3a29c98d40 Don't overwrite transportError in DATA processing
There may already be a transportError, in which case we want to augment
it and not overwrite it.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83807747
2015-01-15 13:37:38 -08:00
nathanmittler 11c363a7ae Disallowing message delivery after status has been delivered to the listener.
Summary of changes:

1) Merged the interfaces MessageDeframer2.Sink and DeframerListener into
MessageDeframer2.Listener. This simplifies the interface of
MessageDeframer2 quite a bit.

2) Added a deliveryPaused() handler to MessageDeframer2.Listener, which
is called by the deframer when there is not enough data to read/deliver
the next message.

3) Modified AbstractStream and AbstractClientStream to manage the timing
of when the closed() event is delivered to the listener. The
transportReportStatus ultimately controls this by creating a task to
close the listener. It either runs this task immediately or when the
next deliveryPaused() event occurs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83620903
2015-01-09 17:00:25 -08:00
yangg f8524a17b8 Add package name to the method string.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83353207
2015-01-08 14:43:24 -08:00
ejona c0f41920bd Remove gRPC v1 support.
No major refactorings/simplifications were done. Only gRPC v1 support
infrastructure was removed.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82737436
2015-01-08 14:43:23 -08:00
nathanmittler 164b734aa9 Adding gradle build for Java grpc
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82152044
2015-01-08 14:43:21 -08:00
nathanmittler 66ce6677b2 Updating version of gRPC maven build to 0.1.0-SNAPSHOT.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82151533
2015-01-08 14:43:20 -08:00
ejona fc30031fd1 Change default gRPC protocol to v2.
Any place that force-sets the protocol to 2 or assumes the old value
is now removed. Unfortunately, it seems InProcessTransportTest has
some non-obvious dependency on gRPC v1.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81597524
2015-01-08 14:43:18 -08:00
lryan 56e307fcb6 Add BSD license header to all source files
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81447025
2015-01-08 14:43:17 -08:00
zhangkun 2b116ef2cd Encode binary headers with Base64 on the wire, and requires all binary headers
have "-bin" suffix in their names.

Split Metadata.Marshaller into BinaryMarshaller and AsciiMarshaller.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81306135
2015-01-08 14:43:15 -08:00
zhangkun 63fc64761a Inspect content type from trailers when there are no headers.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81291102
2015-01-08 14:43:14 -08:00
ejona fb09bba456 Don't leak decompressor in gRPC v2.
We don't use the decompressor at all in gRPC v2, but it may still have
resources that should be close()d.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81271990
2015-01-08 14:43:14 -08:00
zhangkun 8375cd00e8 GRPC Java clients will send the "te: trailers" header, and the server will
check for it, so that we can detect intermediate proxies that do not support
trailers.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81084983
2015-01-08 14:43:13 -08:00
zhangkun 4332c2f56e Change the HTTP code -> GRPC Status mapping to comply with http canonical mapping
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80767939
2015-01-08 14:43:13 -08:00
lryan c5e70c2310 Remove StreamState and use inboundPhase/outboundPhase instead
Remove synchronization on stateLock as we are not required to be thread safe
Add better toString for stream impls
Internal cleanup of various 'status' fields in AbstractClientStream
Remove 'stashTrailers' as we've already extracted status in layer above correctly

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80678356
2015-01-08 14:43:12 -08:00
ejona f96e7e8c6c Use real TLS security by default.
The client now checks certificates and performs hostname verification.
Tests check certificates, so the server uses a cert that the client
trusts.

Only the client portion of SslContextFactory was previously used.
Applications that want to ignore certificates (i.e., for testing) can
use io.netty.handler.ssl.util.InsecureTrustManagerFactory instead.

The MOE configuration was already failing to work, and so required the
simple mapping for examples in addition to what was needed for the new
certs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80434148
2015-01-08 14:43:11 -08:00
zhangkun 054f595eaa Separate the default event loop groups for client and server, to prevent
contention between client and server in the same test process.
Name the threads of default thread pools.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80326782
2015-01-08 14:43:10 -08:00
nathanmittler 63271f4729 Fixing a compatibility issue between the GFE and gRPC java client for the V2 protocol.
The GFE should not be sending DATA frames with endOfStream=true.
However to make things work in the short-term, if we receive one we
still need to process the DATA frame.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80243944
2015-01-08 14:43:09 -08:00
nathanmittler 5d953e840b Updating gRPC code to use the latest Netty with application-level flow control support.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80230204
2015-01-08 14:43:09 -08:00
ejona 01152e093d Fix workaround in place for GFE's lack of trailers.
A recent refactoring moved code so our previous workaround stopped
producing any effect.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79965647
2015-01-08 14:43:08 -08:00
ejona 0f56c47ac8 Handle exceptions thrown by the application
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79895899
2015-01-08 14:43:08 -08:00
lryan 1f2a1869e5 Fix NullPointerException in AbstractServerStream when deframer reports error and fix error message propagation
Improve detail of deframer error reporting to client

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79799152
2015-01-08 14:43:07 -08:00
zhangkun aa0b7cc9af Forbid calling next more than once in interceptors.
Will throw IllegalStateException.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79717262
2015-01-08 14:43:07 -08:00
lryan 4073a8a1a7 Remove redundant field from AbstractClientStream
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79592498
2015-01-08 14:43:07 -08:00
lryan 669724a588 Rationalize the XXXStream classes to reduce code smear and make Netty/OkHTTP behave more consistently.
More cleanups to follow
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79574504
2015-01-08 14:43:06 -08:00
ejona ff669ac9c2 More precise Builder generics
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79430607
2015-01-08 14:43:06 -08:00
zhangkun 776ff86687 Eliminate ForwardingChannel and switch all use cases to client interceptors.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79360027
2015-01-08 14:43:04 -08:00
zhangkun 48e734d7e3 Dedicated ClientInterceptor interface and utilities.
This will replace the channel-wrapping technique as the official
solution of intercepting calls on the client side. It is done in the
same manner as ServerInterceptor.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79280263
2015-01-08 14:43:04 -08:00
ejona 9a148a5022 Remove outbound flow control interface.
We know we don't like the API, but don't yet have the new one in place.
Remove the old one now instead of waiting further, because we are
getting more users who are more likely to try to start using the API.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79090165
2015-01-08 14:43:03 -08:00
nathanmittler ffc18f6c57 Adding MOE configuration for grpc_java.
The TestService proto is temporarily supplied as a generated jar (until the open source protoc compiler supports grpc).

Copies of messages.proto, empty.proto, and message_set.proto are scrubbed and included in the source under integration-testing.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78711468
2015-01-08 14:43:02 -08:00
zhangkun 7dc48e2787 SharedResourceHolder is a utility that manages expensive resources (thread
pools etc) that are shared among channels and servers as default values when
the application doesn't provide its own.

It uses reference counting to shut down resources with a delay.

Changed the channel and server builders to use it for default values of
executors and event loop groups.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78629204
2015-01-08 14:43:01 -08:00
nathanmittler 29cbef1f9b Renaming gRPC-java "newtransport" package to just "transport".
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78596663
2015-01-08 14:43:00 -08:00
simonma 3c986bbcdb Move protobuf code dependencies to net/stubby/proto
Remove needless proto dependencies from tests

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78593107
2015-01-08 14:42:59 -08:00
nathanmittler 0304b3d6b2 Cleaning up various compiler warnings in preparation for opensource.
overview:
1) Lots of @SuppressWarnings :)

2) Remove dependencies on StandardCharsets.XXX (which is Java 7)

3) Moved testing/utils/ssl/* to .../stubby/util so that the netty transport doesn't depend directly on the testing module.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78460727
2015-01-08 14:42:59 -08:00
ejona df9867def9 Support early-OK from Server.
The semantics in gRPC changed where server sending OK before client
half-closes is now permitted.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78404390
2015-01-08 14:42:58 -08:00
ejona 0a585333ce Pre-serialize status codes, for efficiency
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78401520
2015-01-08 14:42:58 -08:00
ejona 46118bb195 Add server support for TLS.
Note that we don't yet have plumbing to use a particular certificate for tests, so it isn't integration-test worthy yet.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78369023
2015-01-08 14:42:57 -08:00
simonma 988f219b04 Handle Headers and Trailers in OkHttp client transport.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78313233
2015-01-08 14:42:57 -08:00
simonma 1e55c6e3f1 Remove Deframer and InputStreamDeframer since we are not using them anymore.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78211270
2015-01-08 14:42:57 -08:00
simonma 2ce8215b0c Fix bug 18054433, only register one listener on transport service.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78112905
2015-01-08 14:42:56 -08:00
nathanmittler 28fb46ef49 Updates to migrate to the latest Netty version.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78008410
2015-01-08 14:42:56 -08:00
lryan 28497e3c7e Add support for servers to deliver response headers
Fixes some propagation issues for trailers too
Adds some more testing for metadata exchange

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77979593
2015-01-08 14:42:56 -08:00
simonma 29d8c03636 Support inbound flow control in okhttp transport, and the first step to support V2 protocol.
Will add the header/trailer support in the following cl.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77975189
2015-01-08 14:42:55 -08:00
zhangkun b95c094e7f The client and server usage examples based on stock.proto.
Also add forAddress(String host, int port) to NettyChannelBuilder.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77909737
2015-01-08 14:42:55 -08:00