blob: d937b3a55743dfb1fef787776c97782a19acb6ac [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
14[Stream Observer](https://github.com/google/grpc-java/blob/master/stub/src/main/java/com/google/net/stubby/stub/StreamObserver.java)
15
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
23* [Metadata - headers & trailers](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/Metadata.java)
24* [Status - error code namespace & handling](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/Status.java)
25
26#### Client
27* [Channel - client side binding](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/Channel.java)
28* [Call](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/Call.java)
29* [Client Interceptor](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/ClientInterceptor.java)
30
31#### Server
32* [Server call handler - analog to Channel on server](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/ServerCallHandler.java)
33* [Server Call](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/ServerCall.java)
34
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
42* [Stream](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/transport/Stream.java)
43* [Stream Listener](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/transport/StreamListener.java)
44
45#### Client
46
47* [Client Stream](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/transport/ClientStream.java)
48* [Client Stream Listener](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/transport/ClientStreamListener.java)
49
50#### Server
51
52* [Server Stream](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/transport/ServerStream.java)
53* [Server Stream Listener](https://github.com/google/grpc-java/blob/master/core/src/main/java/com/google/net/stubby/transport/ServerStreamListener.java)
54
55
56# Examples
57
58Tests 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/com/google/net/stubby/testing/integration