blob: 97f4f02a9d75e49cd789b03dabea1a61fa1b5517 [file] [log] [blame] [view]
ejonad4531da2014-12-15 10:24:42 -08001grpc-java
2=========
3
4Heres a quick readers guide to the code to help folks get started. At a high level there are three distinct layers
5to the library: stub, channel & transport.
6
7## Stub
8
9The 'stub' layer is what is exposed to most developers and provides type-safe bindings to whatever
10datamodel/IDL/interface you are adapting. An example is provided of a binding to code generated by the protocol-buffers compiler but others should be trivial to add and are welcome.
11
12#### Key Interfaces
13
nmittlerf8314582015-01-27 10:25:39 -080014[Stream Observer](https://github.com/google/grpc-java/blob/master/stub/src/main/java/io/grpc/stub/StreamObserver.java)
ejonad4531da2014-12-15 10:24:42 -080015
16
17## Channel
18
19The 'channel' layer is an abstraction over transport handling that is suitable for interception/decoration and exposes more behavior to the application than the stub layer. It is intended to be easy for application frameworks to use this layer to address cross-cutting concerns such as logging, monitoring, auth etc. Flow-control is also exposed at this layer to allow more sophisticated applications to interact with it directly.
20
21#### Common
22
nmittlerf8314582015-01-27 10:25:39 -080023* [Metadata - headers & trailers](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/Metadata.java)
24* [Status - error code namespace & handling](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/Status.java)
ejonad4531da2014-12-15 10:24:42 -080025
26#### Client
nmittlerf8314582015-01-27 10:25:39 -080027* [Channel - client side binding](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/Channel.java)
28* [Call](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/Call.java)
29* [Client Interceptor](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/ClientInterceptor.java)
ejonad4531da2014-12-15 10:24:42 -080030
31#### Server
nmittlerf8314582015-01-27 10:25:39 -080032* [Server call handler - analog to Channel on server](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/ServerCallHandler.java)
33* [Server Call](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/ServerCall.java)
ejonad4531da2014-12-15 10:24:42 -080034
35
36## Transport
37
38The 'transport' layer does the heavy lifting of putting & taking bytes off the wire. The interfaces to it are abstract just enough to allow plugging in of different implementations. Transports are modeled as 'Stream' factories. The variation in interface between a server stream and a client stream exists to codify their differing semantics for cancellation and error reporting.
39
40#### Common
41
nmittlerf8314582015-01-27 10:25:39 -080042* [Stream](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/transport/Stream.java)
43* [Stream Listener](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/transport/StreamListener.java)
ejonad4531da2014-12-15 10:24:42 -080044
45#### Client
46
nmittlerf8314582015-01-27 10:25:39 -080047* [Client Stream](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/transport/ClientStream.java)
48* [Client Stream Listener](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/transport/ClientStreamListener.java)
ejonad4531da2014-12-15 10:24:42 -080049
50#### Server
51
nmittlerf8314582015-01-27 10:25:39 -080052* [Server Stream](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/transport/ServerStream.java)
53* [Server Stream Listener](https://github.com/google/grpc-java/blob/master/core/src/main/java/io/grpc/transport/ServerStreamListener.java)
ejonad4531da2014-12-15 10:24:42 -080054
55
56# Examples
57
nmittlerf8314582015-01-27 10:25:39 -080058Tests showing how these layers are composed to execute calls using protobuf messages can be found here https://github.com/google/grpc-java/tree/master/integration-testing/src/main/java/io/grpc/testing/integration