Commit Graph

375 Commits

Author SHA1 Message Date
Kun Zhang bb113ad721 Use timeout when verifying setDecompressionRegistry()
because setDecompressionRegistry() could be called from a different
thread than the test thread.
2015-10-01 17:35:04 -07:00
Kun Zhang be400d3ea8 Stub mockTransport.newStream() to prevent NPE. 2015-10-01 16:16:35 -07:00
Kun Zhang 89288465c4 Prepare channel layer for upcoming load-balancing changes.
- ListenableFutures of transports, instead of actual transports, are
  passed through multiple layers to ClientCallImpl, so that name
  resolution and load-balancing, which may delay the creation of
  transports, won't block the creation of ClientCall. This also
  simplifies reconnect logic.
- Moved Transport management for a single address to a separate class
  TransportSet. Later, ManagedChannelImpl will own multiple
  TransportSets instead of one.
- ClientCallImpl will buffer requests in DelayedStream until transport
  is ready.
2015-09-29 18:49:38 -07:00
Carl Mastrangelo 46c18ea237 Move decompressor setting down into the AbstractStream 2015-09-28 10:25:58 -07:00
nmittler 7c2ff632cd Fixing flaky test Http2NettyTest.deadlineExceeded()
This test occasionally flakes due to the way the deadline timer cancels the stream. Stream cancellation immediately closes the outbound status, disallowing the sending of further messages.  The true cancellation is done sometime later in the transport thread in Netty. So there is a race between closing the outbound status and performing the actual cancellation where sent messages will fail with the wrong status.
2015-09-24 16:22:46 -07:00
Éamonn McManus 9e690f8ddf Make io.grpc.Status.STATUS_LIST be static final, not just static. 2015-09-21 11:02:19 -07:00
Carl Mastrangelo 5dad18c54b Pass decompressor registry around and make it less static 2015-09-18 12:47:41 -07:00
Eric Anderson 4cc103ac6a Mark Status*Exception.getStatus() final
This further limits our API.
2015-09-17 14:10:53 -07:00
Carl Mastrangelo 4572b197e0 Add a message accept encoding header 2015-09-17 12:30:04 -07:00
Eric Anderson 6e0651643e Mark more server-side pieces experimental
You can't make an interceptor without calling ServerCallHandler, so it
is now marked experimental.
2015-09-14 15:24:24 -07:00
Eric Anderson 491a98afc5 Restrict more of the API: Metadata, ServerCall, Status 2015-09-14 15:24:22 -07:00
Carl Mastrangelo 4b27e542e0 Don't let server start if already shutting down 2015-09-14 11:39:28 -07:00
Eric Anderson 1cfba96d17 Enforce sending headers before messages on server
ServerCall already had "headers must be sent before any messages, which
must be sent before closing," but the implementation did not enforce it
and our async server handler didn't obey.

The benefit of forcing sending headers first is that it removes the only
implicit call in our API and interceptors dealing just with metadata
don't need to override sendMessage. The implicit behavior was bug-prone
since it wasn't obvious you were forgetting that headers may not be
sent.
2015-09-11 17:39:40 -07:00
Eric Anderson f894339923 request() is thread-safe
It is typically used for receiving, but is on the sending object. It
would be a pain for users to coordinate, and the implementation is
already thread-safe because we always thought it would be thread-safe.
So make it part of the documentation.
2015-09-11 17:36:23 -07:00
Eric Anderson 9cb36c6e20 Mark some APIs codegen uses experimental to allow for optimizations
Fixes #975
2015-09-11 11:13:27 -07:00
Carl Mastrangelo f6582d822d Add a hook to set TLS 2015-09-11 10:03:30 -07:00
Eric Anderson 538cf215f0 Add usePlaintext to ManagedChannelBuilder 2015-09-11 09:57:42 -07:00
Eric Anderson 5b2a03a02e Add overrideAuthority to ManagedChannelBuilder
We want to allow overriding authority in the ManagedChannelBuilder for
testing. In doing that, we basically require that all Channels support
authority. In reality, this simplifies things and is already being done
by the C implementation, as their unix domain socket support uses
"localhost" just like our in-process transport now does.

We can debate some whether "localhost" is really the most appropriate
authority for the in-process transport, but that should probably happen
later since "localhost" is "good enough" for now.
2015-09-11 09:37:49 -07:00
Eric Anderson 3ae18eaef1 Add overrideAuthority to NettyChannelBuilder
Although the functionality is currently available by passing a
manually-created InetAddress, that requires that the user do I/O before
calling our API and does not work with naming in the future.
2015-09-11 09:37:43 -07:00
Eric Anderson a6621daca2 Private ServerMethodDefinition constructor; avoid create() in codegen
There is no need to use ServerMethodDefinition in codegen. The create()
method itself could be helpful to a dynamic HandlerRegistry
implementation, so we won't remove it.
2015-09-11 09:25:24 -07:00
Carl Mastrangelo 416b745d8d Add a Server Provider 2015-09-10 12:23:17 -07:00
Eric Anderson df7bf44687 Enable license header checking in checkstyle 2015-09-10 11:29:00 -07:00
Carl Mastrangelo e969a900a0 Add proper generics to ManagedChannelProvider 2015-09-10 09:52:13 -07:00
Eric Anderson 31394aa9df Let transports be channel service providers for generic usage
This provides an API for applications to use gRPC without using
ExperimentalApis. It also allows swapping out a transport implementation
in the future.
2015-09-09 11:06:35 -07:00
Carl Mastrangelo 3cf76326a2 Move decompressor setting to Server Impl 2015-09-08 13:03:27 -07:00
Carl Mastrangelo 950fe1d108 Use ReqT and RespT for generics 2015-09-08 12:51:03 -07:00
Kun Zhang ae4ee40711 Fix flow-control documentation on Stream 2015-09-08 10:20:07 -07:00
Carl Mastrangelo 1ad2bf9eda Add a way to distinguish between advertised message encodings, and add tests 2015-09-04 14:42:45 -07:00
Carl Mastrangelo ebe8a0d703 Remove Metadata.Headers and Metadata.Trailers 2015-09-03 15:22:45 -07:00
Carl Mastrangelo f612746b97 Update comment in MethodDescriptor.Marshaller 2015-09-03 15:10:18 -07:00
Carl Mastrangelo 28d51c5e3e Add an authority header to HandlerRegistry.lookupMethod 2015-09-03 15:03:02 -07:00
Carl Mastrangelo 5d34599390 Daemonize InProcess threads 2015-09-03 14:57:20 -07:00
Louis Ryan 6a782a035e Use Executor in stable builder APIs instead of ExecutorService 2015-09-03 14:38:13 -07:00
Carl Mastrangelo f641e081a0 Daemonize shared threads, and make sure each thread has a name 2015-09-03 14:25:53 -07:00
Eric Anderson 6122dafee0 Add a missing channel builder methods not copied in b687bdc 2015-09-03 12:21:47 -07:00
nmittler b687bdc742 Refactoring channel API.
Client:
* New ManagedChannel abstract class.
* Adding ping to Channel.
* Moving builders and implementations to internal.

Server:
* Added lifecycle management API to Server (mirroring ManagedChannel).
* Moved ServerImpl, AbstractServerBuilder and handler registries to internal.
* New ServerBuilder abstract class (mirroring ManagedChannelBuilder).

Fixes #545
2015-09-03 11:22:29 -07:00
Kun Zhang 65b4e0b1f2 Document valid characters allowed in metadata keys 2015-09-03 10:49:04 -07:00
Xudong Ma 00e024c684 Fix Travis breakage caused by checkStyle failure. 2015-09-03 09:46:22 -07:00
Kun Zhang 609f31a578 Document valid characters for AsciiMarshaller 2015-09-02 15:57:07 -07:00
Carl Mastrangelo f8a87eecce Remove HandlerRegistry.Method 2015-09-02 14:37:44 -07:00
Eric Anderson 01ba973dd4 Prevent status from impacting how ServerCall.Listener is invoked
Fixes #639
2015-09-02 09:48:05 -07:00
Eric Anderson 210114d4a2 Ease use of JWT by passing URI to auth library
The URI no longer needs to be provided to the Credential explicitly,
which prevents needing to know a magic string and allows using the same
Credential with multiple services.
2015-09-01 15:42:58 -07:00
nmittler 6a526ecc93 Adding missing RunWith annotation for tests. 2015-09-01 11:40:17 -07:00
nmittler d3ab427fca Enforce content-type on client and server.
Fixes #360
2015-09-01 06:59:46 -07:00
Eric Anderson 949b6d7da8 Fields in MethodDescriptor can't be null 2015-08-31 17:48:05 -07:00
Carl Mastrangelo 396f0606f3 Add test to prove RST closes stream, and remove hack from transport to force closure. 2015-08-31 13:26:49 -07:00
Carl Mastrangelo d678498ca7 Add unit tests for AbstractServerStream 2015-08-28 13:00:27 -07:00
Stanley Cheung e4987cd1f2 update reference to grpc-common to examples 2015-08-27 16:10:33 -07:00
Carl Mastrangelo 080190c753 Make ServerCall.Listener methods Nops 2015-08-27 13:13:42 -07:00
Carl Mastrangelo 5ade1b726f Make ClientCall listener methods noops 2015-08-27 11:36:59 -07:00