diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 05b6a75..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2015, grpc
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of grpc-common nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/PATENTS b/PATENTS
deleted file mode 100644
index 619f9db..0000000
--- a/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the GRPC project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of GRPC, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of GRPC. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of GRPC or any code incorporated within this
-implementation of GRPC constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of GRPC
-shall terminate as of the date such litigation is filed.
diff --git a/PROTOCOL-HTTP2.md b/PROTOCOL-HTTP2.md
deleted file mode 100644
index d3fbb60..0000000
--- a/PROTOCOL-HTTP2.md
+++ /dev/null
@@ -1,192 +0,0 @@
-# gRPC over HTTP2
-
-## Introduction
-This document serves as a detailed description for an implementation of gRPC carried over HTTP2 draft 17 framing. It assumes familiarity with the HTTP2 specification.
-
-## Protocol
-Production rules are using ABNF syntax.
-
-### Outline
-
-The following is the general sequence of message atoms in a GRPC request & response message stream
-
-* Request → Request-Headers *Delimited-Message EOS
-* Response → (Response-Headers *Delimited-Message Trailers) / Trailers-Only
-
-
-### Requests
-
-* Request → Request-Headers *Delimited-Message EOS
-
-Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames.
-
-* **Request-Headers** → Call-Definition *Custom-Metadata
-* **Call-Definition** → Method Scheme Path TE [Authority] [Timeout] [Content-Type] [Message-Type] [Message-Encoding] [Message-Accept-Encoding] [User-Agent]
-* **Method** → “:method POST”
-* **Scheme** → “:scheme ” (“http” / “https”)
-* **Path** → “:path” {_path identifying method within exposed API_}
-* **Authority** → “:authority” {_virtual host name of authority_}
-* **TE** → “te” “trailers” # Used to detect incompatible proxies
-* **Timeout** → “grpc-timeout” TimeoutValue TimeoutUnit
-* **TimeoutValue** → {_positive integer as ASCII string of at most 8 digits_}
-* **TimeoutUnit** → Hour / Minute / Second / Millisecond / Microsecond / Nanosecond
-* **Hour** → “H”
-* **Minute** → “M”
-* **Second** → “S”
-* **Millisecond** → “m”
-* **Microsecond** → “u”
-* **Nanosecond** → “n”
-* **Content-Type** → “content-type” “application/grpc” [(“+proto” / “+json” / {_custom_})]
-* **Content-Coding** → “gzip” / “deflate” / “snappy” / {_custom_}
-* **Message-Encoding** → “grpc-encoding” Content-Coding
-* **Message-Accept-Encoding** → “grpc-accept-encoding” Content-Coding *("," Content-Coding)
-* **User-Agent** → “user-agent” {_structured user-agent string_}
-* **Message-Type** → “grpc-message-type” {_type name for message schema_}
-* **Custom-Metadata** → Binary-Header / ASCII-Header
-* **Binary-Header** → {lowercase ASCII header name ending in “-bin” } {_base64 encoded value_}
-* **ASCII-Header** → {lowercase ASCII header name} {_value_}
-
-
-HTTP2 requires that reserved headers, ones starting with “:” appear before all other headers. Additionally implementations should send **Timeout** immediately after the reserved headers and they should send the **Call-Definition** headers before sending **Custom-Metadata**.
-
-If **Timeout** is omitted a server should assume an infinite timeout. Client implementations are free to send a default minimum timeout based on their deployment requirements.
-
-**Custom-Metadata** is an arbitrary set of key-value pairs defined by the application layer. Aside from transport limits on the total length of HTTP2 HEADERS the only other constraint is that header names starting with “grpc-” are reserved for future use.
-
-Note that HTTP2 does not allow arbitrary octet sequences for header values so binary header values must be encoded using Base64 as per https://tools.ietf.org/html/rfc4648#section-4. Implementations MUST accept padded and un-padded values and should emit un-padded values. Applications define binary headers by having their names end with “-bin”. Runtime libraries use this suffix to detect binary headers and properly apply base64 encoding & decoding as headers are sent and received.
-
-The repeated sequence of **Delimited-Message** items is delivered in DATA frames
-
-* **Delimited-Message** → Compressed-Flag Message-Length Message
-* **Compressed-Flag** → 0 / 1 # encoded as 1 byte unsigned integer
-* **Message-Length** → {_length of Message_} # encoded as 4 byte unsigned integer
-* **Message** → *{binary octet}
-
-A **Compressed-Flag** value of 1 indicates that the binary octet sequence of **Message** is compressed using the mechanism declared by the **Message-Encoding** header. A value of 0 indicates that no encoding of **Message** bytes has occurred. Compression contexts are NOT maintained over message boundaries, implementations must create a new context for each message in the stream. If the **Message-Encoding** header is omitted then the **Compressed-Flag** must be 0.
-
-For requests, **EOS** (end-of-stream) is indicated by the presence of the END_STREAM flag on the last received DATA frame. In scenarios where the **Request** stream needs to be closed but no data remains to be sent implementations MUST send an empty DATA frame with this flag set.
-
-###Responses
-
-* **Response** → (Response-Headers *Delimited-Message Trailers) / Trailers-Only
-* **Response-Headers** → HTTP-Status [Message-Encoding] [Message-Accept-Encoding] Content-Type *Custom-Metadata
-* **Trailers-Only** → HTTP-Status Content-Type Trailers
-* **Trailers** → Status [Status-Message] *Custom-Metadata
-* **HTTP-Status** → “:status 200”
-* **Status** → “grpc-status”
-* **Status-Message** → “grpc-message”
-
-**Response-Headers** & **Trailers-Only** are each delivered in a single HTTP2 HEADERS frame block. Most responses are expected to have both headers and trailers but **Trailers-Only** is permitted for calls that produce an immediate error. Status must be sent in **Trailers** even if the status code is OK.
-
-For responses end-of-stream is indicated by the presence of the END_STREAM flag on the last received HEADERS frame that carries **Trailers**.
-
-Implementations should expect broken deployments to send non-200 HTTP status codes in responses as well as a variety of non-GRPC content-types and to omit **Status** & **Status-Message**. Implementations must synthesize a **Status** & **Status-Message** to propagate to the application layer when this occurs.
-
-####Example
-
-Sample unary-call showing HTTP2 framing sequence
-
-**Request**
-
-```
-HEADERS (flags = END_HEADERS)
-:method = POST
-:scheme = http
-:path = /google.pubsub.v2.PublisherService/CreateTopic
-:authority = pubsub.googleapis.com
-grpc-timeout = 1S
-content-type = application/grpc+proto
-grpc-encoding = gzip
-authorization = Bearer y235.wef315yfh138vh31hv93hv8h3v
-
-DATA (flags = END_STREAM)
-
-```
-**Response**
-```
-HEADERS (flags = END_HEADERS)
-:status = 200
-grpc-encoding = gzip
-
-DATA
-
-
-HEADERS (flags = END_STREAM, END_HEADERS)
-grpc-status = 0 # OK
-trace-proto-bin = jher831yy13JHy3hc
-```
-####User Agents
-
-While the protocol does not require a user-agent to function it is recommended that clients provide a structured user-agent string that provides a basic description of the calling library, version & platform to facilitate issue diagnosis in heterogeneous environments. The following structure is recommended to library developers
-```
-User-Agent → “grpc-” Language ?(“-” Variant) “/” Version ?( “ (“ *(AdditionalProperty “;”) “)” )
-```
-E.g.
-
-```
-grpc-java/1.2.3
-grpc-ruby/1.2.3
-grpc-ruby-jruby/1.3.4
-grpc-java-android/0.9.1 (gingerbread/1.2.4; nexus5; tmobile)
-```
-####HTTP2 Transport Mapping
-
-#####Stream Identification
-All GRPC calls need to specify an internal ID. We will use HTTP2 stream-ids as call identifiers in this scheme. NOTE: These id’s are contextual to an open HTTP2 session and will not be unique within a given process that is handling more than one HTTP2 session nor can they be used as GUIDs.
-
-#####Data Frames
-DATA frame boundaries have no relation to **Delimited-Message** boundaries and implementations should make no assumptions about their alignment.
-
-#####Errors
-
-When an application or runtime error occurs during an RPC a **Status** and **Status-Message** are delivered in **Trailers**.
-
-In some cases it is possible that the framing of the message stream has become corrupt and the RPC runtime will choose to use an **RST_STREAM** frame to indicate this state to its peer. RPC runtime implementations should interpret RST_STREAM as immediate full-closure of the stream and should propagate an error up to the calling application layer.
-
-The following mapping from RST_STREAM error codes to GRPC error codes is applied.
-
-HTTP2 Code|GRPC Code
-----------|-----------
-NO_ERROR(0)|INTERNAL - An explicit GRPC status of OK should have been sent but this might be used to aggressively lameduck in some scenarios.
-PROTOCOL_ERROR(1)|INTERNAL
-INTERNAL_ERROR(2)|INTERNAL
-FLOW_CONTROL_ERROR(3)|INTERNAL
-SETTINGS_TIMEOUT(4)|INTERNAL
-STREAM_CLOSED|No mapping as there is no open stream to propagate to. Implementations should log.
-FRAME_SIZE_ERROR|INTERNAL
-REFUSED_STREAM|UNAVAILABLE - Indicates that no processing occurred and the request can be retried, possibly elsewhere.
-CANCEL(8)|Mapped to call cancellation when sent by a client.Mapped to CANCELLED when sent by a server. Note that servers should only use this mechanism when they need to cancel a call but the payload byte sequence is incomplete.
-COMPRESSION_ERROR|INTERNAL
-CONNECT_ERROR|INTERNAL
-ENHANCE_YOUR_CALM|RESOURCE_EXHAUSTED ...with additional error detail provided by runtime to indicate that the exhausted resource is bandwidth.
-INADEQUATE_SECURITY| PERMISSION_DENIED … with additional detail indicating that permission was denied as protocol is not secure enough for call.
-
-
-#####Security
-
-The HTTP2 specification mandates the use of TLS 1.2 or higher when TLS is used with HTTP2. It also places some additional constraints on the allowed ciphers in deployments to avoid known-problems as well as requiring SNI support. It is also expected that HTTP2 will be used in conjunction with proprietary transport security mechanisms about which the specification can make no meaningful recommendations.
-
-#####Connection Management
-######GOAWAY Frame
-Sent by servers to clients to indicate that they will no longer accept any new streams on the associated connections. This frame includes the id of the last successfully accepted stream by the server. Clients should consider any stream initiated after the last successfully accepted stream as UNAVAILABLE and retry the call elsewhere. Clients are free to continue working with the already accepted streams until they complete or the connection is terminated.
-
-Servers should send GOAWAY before terminating a connection to reliably inform clients which work has been accepted by the server and is being executed.
-
-######PING Frame
-Both clients and servers can send a PING frame that the peer must respond to by precisely echoing what they received. This is used to assert that the connection is still live as well as providing a means to estimate end-to-end latency. If a server initiated PING does not receive a response within the deadline expected by the runtime all outstanding calls on the server will be closed with a CANCELLED status. An expired client initiated PING will cause all calls to be closed with an UNAVAILABLE status. Note that the frequency of PINGs is highly dependent on the network environment, implementations are free to adjust PING frequency based on network and application requirements.
-
-######Connection failure
-If a detectable connection failure occurs on the client all calls will be closed with an UNAVAILABLE status. For servers open calls will be closed with a CANCELLED status.
-
-
-### Appendix A - GRPC for Protobuf
-
-The service interfaces declared by protobuf are easily mapped onto GRPC by code generation extensions to protoc. The following defines the mapping to be used
-
-
-* **Path** → / Service-Name / {_method name_}
-* **Service-Name** → ?( {_proto package name_} "." ) {_service name_}
-* **Message-Type** → {_fully qualified proto message name_}
-* **Content-Type** → "application/grpc+proto"
-
-
diff --git a/README.md b/README.md
index 5939db3..fa0ff10 100644
--- a/README.md
+++ b/README.md
@@ -1,449 +1,14 @@
-# Getting started
+# The gRPC documentation and examples have been moved!
-Welcome to the developer documentation for gRPC, a language-neutral,
-platform-neutral remote procedure call (RPC) system developed at Google.
-
-This document introduces you to gRPC with a quick overview and a simple
-Hello World example. You'll find more tutorials and reference docs in this repository - more documentation is coming soon!
-
-
-## Quick start
You can find quick start guides for each language, including installation instructions, examples, and tutorials here:
-* [C++](https://github.com/grpc/grpc-common/tree/master/cpp)
-* [Java](https://github.com/grpc/grpc-common/tree/master/java)
-* [Go](https://github.com/grpc/grpc-common/tree/master/go)
-* [Ruby](https://github.com/grpc/grpc-common/tree/master/ruby)
-* [Node.js](https://github.com/grpc/grpc-common/tree/master/node)
-* [Android Java](https://github.com/grpc/grpc-common/tree/master/java/android)
-* [Python](https://github.com/grpc/grpc-common/tree/master/python/helloworld)
-* [C#](https://github.com/grpc/grpc-common/tree/master/csharp)
-* [Objective-C](https://github.com/grpc/grpc-common/tree/master/objective-c/route_guide)
-
-## What's in this repository?
-
-The `grpc-common` repository contains documentation, resources, and examples
-for all gRPC users. You can find examples and instructions specific to your
-favourite language in the relevant subdirectory.
-
-You can find out about the gRPC source code repositories in
-[`grpc`](https://github.com/grpc/grpc). Each repository provides instructions
-for building the appropriate libraries for your language.
-
-
-## What is gRPC?
-
-In gRPC a *client* application can directly call
-methods on a *server* application on a different machine as if it was a
-local object, making it easier for you to create distributed applications and
-services. As in many RPC systems, gRPC is based around the idea of defining
-a *service*, specifying the methods that can be called remotely with their
-parameters and return types. On the server side, the server implements this
-interface and runs a gRPC server to handle client calls. On the client side,
-the client has a *stub* that provides exactly the same methods as the server.
-
-
-
-gRPC clients and servers can run and talk to each other in a variety of
-environments - from servers inside Google to your own desktop - and can
-be written in any of gRPC's [supported languages](#quickstart). So, for
-example, you can easily create a gRPC server in Java with clients in Go,
-Python, or Ruby. In addition, the latest Google APIs will have gRPC versions
-of their interfaces, letting you easily build Google functionality into
-your applications.
-
-
-### Working with protocol buffers
-
-By default gRPC uses *protocol buffers*, Google’s
-mature open source mechanism for serializing structured data (although it
-can be used with other data formats such as JSON). As you'll
-see in our example below, you define gRPC services using *proto files*,
-with method parameters and return types specified as protocol buffer message
-types. You
-can find out lots more about protocol buffers in the [Protocol Buffers
-documentation](https://developers.google.com/protocol-buffers/docs/overview).
-
-#### Protocol buffer versions
-
-While protocol buffers have been available for open source users for some
-time, our examples use a new flavour of protocol buffers called proto3,
-which has a slightly simplified syntax, some useful new features, and supports
-lots more languages. This is currently available as an alpha release in
-Java, C++, Java_nano (Android Java), Python, and Ruby from [the protocol buffers Github
-repo](https://github.com/google/protobuf/releases), as well as a Go language
-generator from [the golang/protobuf Github repo](https://github.com/golang/protobuf), with more languages in development. You can find out more in the [proto3 language guide](https://developers.google.com/protocol-buffers/docs/proto3), and see
-the major differences from the current default version in the [release notes](https://github.com/google/protobuf/releases). More proto3 documentation is coming soon.
-
-In general, while you *can* use proto2 (the current default protocol buffers version), we recommend that you use proto3 with gRPC as it lets you use the full range of gRPC-supported languages, as well as avoiding compatibility
-issues with proto2 clients talking to proto3 servers and vice versa.
-
-
-## Hello gRPC!
-
-Now that you know a bit more about gRPC, the easiest way to see how it
-works is to look at a simple example. Our Hello World walks you through the
-construction of a simple gRPC client-server application, showing you how to:
-
-- Create a protocol buffers schema that defines a simple RPC service with
-a single
-Hello World method.
-- Create a Java server that implements this interface.
-- Create a Java client that accesses the Java server.
-- Create a Go client that accesses
-the same Java server.
-
-The complete code for the example is available in the `grpc-common` GitHub
-repository. We use the Git versioning system for source code management:
-however, you don't need to know anything about Git to follow along other
-than how to install and run a few git commands.
-
-This is an introductory example rather than a comprehensive tutorial, so
-don't worry if you're not a Go or
-Java developer - the concepts are similar for all languages, and you can
-find more implementations of our Hello World example in other languages (and full tutorials where available) in
-the [language-specific folders](#quickstart) in this repository. Complete tutorials and
-reference documentation for all gRPC languages are coming soon.
-
-
-### Setup
-
-This section explains how to set up your local machine to work with
-the example code. If you just want to read the example, you can go straight
-to the [next step](#servicedef).
-
-#### Install Git
-
-You can download and install Git from http://git-scm.com/download. Once
-installed you should have access to the git command line tool. The main
-commands that you will need to use are:
-
-- git clone ... : clone a remote repository onto your local machine
-- git checkout ... : check out a particular branch or a tagged version of
-the code to hack on
-
-#### Install gRPC
-
-To build and install gRPC plugins and related tools:
-- For Java, see the [Java quick start](https://github.com/grpc/grpc-java).
-- For Go, see the [Go quick start](https://github.com/grpc/grpc-go).
-
-#### Get the source code
-
-The example code for our Java example lives in the `grpc-java`
-GitHub repository. Clone this repository to your local machine by running the
-following command:
-
-
-```
-git clone https://github.com/grpc/grpc-java.git
-```
-
-Change your current directory to grpc-java/examples
-
-```
-cd grpc-java/examples
-```
-
-
-
-
-### Defining a service
-
-The first step in creating our example is to define a *service*: an RPC
-service specifies the methods that can be called remotely with their parameters
-and return types. As you saw in the
-[overview](#protocolbuffers) above, gRPC does this using [protocol
-buffers](https://developers.google.com/protocol-buffers/docs/overview). We
-use the protocol buffers interface definition language (IDL) to define our
-service methods, and define the parameters and return
-types as protocol buffer message types. Both the client and the
-server use interface code generated from the service definition.
-
-Here's our example service definition, defined using protocol buffers IDL in
-[helloworld.proto](https://github.com/grpc/grpc-java/tree/master/examples/src/main/proto). The `Greeter`
-service has one method, `SayHello`, that lets the server receive a single
-`HelloRequest`
-message from the remote client containing the user's name, then send back
-a greeting in a single `HelloReply`. This is the simplest type of RPC you
-can specify in gRPC - you can find out about other types in the tutorial for your chosen language.
-
-```proto
-syntax = "proto3";
-
-option java_package = "io.grpc.examples";
-
-package helloworld;
-
-// The greeter service definition.
-service Greeter {
- // Sends a greeting
- rpc SayHello (HelloRequest) returns (HelloReply) {}
-}
-
-// The request message containing the user's name.
-message HelloRequest {
- string name = 1;
-}
-
-// The response message containing the greetings
-message HelloReply {
- string message = 1;
-}
-
-```
-
-
-### Generating gRPC code
-
-Once we've defined our service, we use the protocol buffer compiler
-`protoc` to generate the special client and server code we need to create
-our application - right now we're going to generate Java code, though you
-can generate gRPC code in any gRPC-supported language (as you'll see later
-in this example). The generated code contains both stub code for clients to
-use and an abstract interface for servers to implement, both with the method
-defined in our `Greeter` service.
-
-(If you didn't install the gRPC plugins and protoc on your system and are just reading along with
-the example, you can skip this step and move
-onto the next one where we examine the generated code.)
-
-For simplicity, we've provided a [Gradle build file](https://github.com/grpc/grpc-java/blob/master/examples/build.gradle) with our Java examples that runs `protoc` for you with the appropriate plugin, input, and output:
-
-```shell
-../gradlew build
-```
-
-This generates the following classes from our .proto, which contain all the generated code
-we need to create our example:
-
-- `Helloworld.java`, which
-has all the protocol buffer code to populate, serialize, and retrieve our
-`HelloRequest` and `HelloReply` message types
-- `GreeterGrpc.java`, which contains (along with some other useful code):
- - an interface for `Greeter` servers to implement
-
- ```java
- public static interface Greeter {
- public void sayHello(io.grpc.examples.Helloworld.HelloRequest request,
- io.grpc.stub.StreamObserver responseObserver);
- }
- ```
-
- - _stub_ classes that clients can use to talk to a `Greeter` server. As you can see, they also implement the `Greeter` interface.
-
- ```java
- public static class GreeterStub extends
- io.grpc.stub.AbstractStub
- implements Greeter {
- ...
- }
- ```
-
-
-### Writing a server
-
-Now let's write some code! First we'll create a server application to implement
-our service. Note that we're not going to go into a lot of detail about how
-to create a server in this section. More detailed information will be in the
-tutorial for your chosen language: check if there's one available yet in the relevant [quick start](#quickstart).
-
-Our server application has two classes:
-
-- a main server class that hosts the service implementation and allows access over the
-network: [HelloWorldServer.java](https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java).
-
-
-- a simple service implementation class [GreeterImpl.java](https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java#L51).
-
-
-#### Service implementation
-
-[GreeterImpl.java](https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java#L51)
-actually implements our `Greeter` service's required behaviour.
-
-As you can see, the class `GreeterImpl` implements the interface
-`GreeterGrpc.Greeter` that we [generated](#generating) from our proto
-[IDL](https://github.com/grpc/grpc-java/tree/master/examples/src/main/proto) by implementing the method `sayHello`:
-
-```java
- @Override
- public void sayHello(HelloRequest req, StreamObserver responseObserver) {
- HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
- responseObserver.onValue(reply);
- responseObserver.onCompleted();
- }
-```
-- `sayHello` takes two parameters:
- - `HelloRequest`: the request
- - `StreamObserver`: a response observer, which is
- a special interface for the server to call with its response
-
-To return our response to the client and complete the call:
-
-1. We construct and populate a `HelloReply` response object with our exciting
-message, as specified in our interface definition.
-2. We return the `HelloReply` to the client and then specify that we've finished dealing with the RPC.
-
-
-#### Server implementation
-
-[HelloWorldServer.java](https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java)
-shows the other main feature required to provide a gRPC service; making the service
-implementation available from the network.
-
-```java
- /* The port on which the server should run */
- private int port = 50051;
- private ServerImpl server;
-
- private void start() throws Exception {
- server = NettyServerBuilder.forPort(port)
- .addService(GreeterGrpc.bindService(new GreeterImpl()))
- .build().start();
- logger.info("Server started, listening on " + port);
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- // Use stderr here since the logger may have been reset by its JVM shutdown hook.
- System.err.println("*** shutting down gRPC server since JVM is shutting down");
- HelloWorldServer.this.stop();
- System.err.println("*** server shut down");
- }
- });
- }
-
-```
-
-Here we create an appropriate gRPC server, binding the `Greeter` service
-implementation that we created to a port. Then we start the server running: the server is now ready to receive
-requests from `Greeter` service clients on our specified port. We'll cover
-how all this works in a bit more detail in our language-specific documentation.
-
-
-### Writing a client
-
-Client-side gRPC is pretty simple. In this step, we'll use the generated code
-to write a simple client that can access the `Greeter` server we created
-in the [previous section](#server). You can see the complete client code in
-[HelloWorldClient.java](https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldClient.java).
-
-Again, we're not going to go into much detail about how to implement a client;
-we'll leave that for the tutorial.
-
-#### Connecting to the service
-
-First let's look at how we connect to the `Greeter` server. First we need
-to create a gRPC channel, specifying the hostname and port of the server we
-want to connect to. Then we use the channel to construct the stub instance.
-
-
-```java
- private final ChannelImpl channel;
- private final GreeterGrpc.GreeterBlockingStub blockingStub;
-
- public HelloWorldClient(String host, int port) {
- channel =
- NettyChannelBuilder.forAddress(host, port).negotiationType(NegotiationType.PLAINTEXT)
- .build();
- blockingStub = GreeterGrpc.newBlockingStub(channel);
- }
-
-```
-
-In this case, we create a blocking stub. This means that the RPC call waits
-for the server to respond, and will either return a response or raise an
-exception. gRPC Java has other kinds of stubs that make non-blocking calls
-to the server, where the response is returned asynchronously.
-
-#### Calling an RPC
-
-Now we can contact the service and obtain a greeting:
-
-1. We construct and fill in a `HelloRequest` to send to the service.
-2. We call the stub's `hello()` RPC with our request and get a `HelloReply`
-back, from which we can get our greeting.
-
-
-```java
- HelloRequest req = HelloRequest.newBuilder().setName(name).build();
- HelloReply reply = blockingStub.sayHello(req);
-
-```
-
-
-### Try it out!
-
-Our [Gradle build file](https://github.com/grpc/grpc-java/blob/master/examples/build.gradle) simplifies building and running the examples.
-
-You can build and run the server from the `grpc-java` root folder with:
-
-```sh
-$ ./gradlew :grpc-examples:helloWorldServer
-```
-
-and in another terminal window confirm that it receives a message.
-
-```sh
-$ ./gradlew :grpc-examples:helloWorldClient
-```
-
-### Adding another client
-
-Finally, let's look at one of gRPC's most useful features - interoperability
-between code in different languages. So far, we've just looked at Java code
-generated from and implementing our `Greeter` service definition. However,
-as you'll see if you look at the language-specific subdirectories
-in this repository, we've also generated and implemented `Greeter`
-in some of gRPC's other supported languages. Each service
-and client uses interface code generated from the same proto
-that we used for the Java example.
-
-So, for example, if we visit the [`go` example
-directory](https://github.com/grpc/grpc-common/tree/master/go) and look at the
-[`greeter_client`](https://github.com/grpc/grpc-common/blob/master/go/greeter_client/main.go),
-we can see that like the Java client, it connects to a `Greeter` service
-at `localhost:50051` and uses a stub to call the `SayHello` method with a
-`HelloRequest`:
-
-```go
-const (
- address = "localhost:50051"
- defaultName = "world"
-)
-
-func main() {
- // Set up a connection to the server.
- conn, err := grpc.Dial(address)
- if err != nil {
- log.Fatalf("did not connect: %v", err)
- }
- defer conn.Close()
- c := pb.NewGreeterClient(conn)
-
- // Contact the server and print out its response.
- name := defaultName
- if len(os.Args) > 1 {
- name = os.Args[1]
- }
- r, err := c.SayHello(context.Background(), &pb.HelloRequest{Name:
- name})
- if err != nil {
- log.Fatalf("could not greet: %v", err)
- }
- log.Printf("Greeting: %s", r.Message)
-}
-```
-
-
-If we run the Java server from earlier in another terminal window, we can
-run the Go client and connect to it just like the Java client, even though
-it's written in a different language.
-
-```
-$ greeter_client
-```
-## Read more!
-
-- You can find links to language-specific tutorials, examples, and other docs in each language's [quick start](#quickstart).
-- [gRPC Authentication Support](https://github.com/grpc/grpc-common/blob/master/grpc-auth-support.md) introduces authentication support in gRPC with supported mechanisms and examples.
+* [C++](https://github.com/grpc/grpc/tree/master/examples/cpp)
+* [Java](https://github.com/grpc/grpc-java/tree/master/examples)
+* [Go](https://github.com/grpc/grpc-go/tree/master/examples)
+* [Ruby](https://github.com/grpc/grpc/tree/master/examples/ruby)
+* [Node.js](https://github.com/grpc/grpc/tree/master/examples/node)
+* [Android Java](https://github.com/grpc/grpc-java/tree/master/examples/android)
+* [Python](https://github.com/grpc/grpc/tree/master/examples/python/helloworld)
+* [C#](https://github.com/grpc/grpc/tree/master/examples/csharp)
+* [Objective-C](https://github.com/grpc/grpc/tree/master/examples/objective-c/route_guide)
+* [PHP](https://github.com/grpc/grpc/tree/master/examples/php/)
diff --git a/cpp/README.md b/cpp/README.md
deleted file mode 100644
index e0a09ff..0000000
--- a/cpp/README.md
+++ /dev/null
@@ -1,65 +0,0 @@
-#gRPC in 3 minutes (C++)
-
-## Installation
-
-To install gRPC on your system, follow the instructions here:
-[https://github.com/grpc/grpc/blob/master/INSTALL](https://github.com/grpc/grpc/blob/master/INSTALL).
-
-## Hello C++ gRPC!
-
-Here's how to build and run the C++ implementation of the [Hello World](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto) example used in [Getting started](https://github.com/grpc/grpc-common).
-
-The example code for this and our other examples lives in the `grpc-common`
-GitHub repository. Clone this repository to your local machine by running the
-following command:
-
-
-```sh
-$ git clone https://github.com/grpc/grpc-common.git
-```
-
-Change your current directory to grpc-common/cpp/helloworld
-
-```sh
-$ cd grpc-common/cpp/helloworld/
-```
-
-
-### Generating gRPC code
-
-To generate the client and server side interfaces:
-
-```sh
-$ make helloworld.grpc.pb.cc helloworld.pb.cc
-```
-Which internally invokes the proto-compiler as:
-
-```sh
-$ protoc -I ../../protos/ --grpc_out=. --plugin=protoc-gen-grpc=grpc_cpp_plugin ../../protos/helloworld.proto
-$ protoc -I ../../protos/ --cpp_out=. ../../protos/helloworld.proto
-```
-
-### Client and server implementations
-
-The client implementation is at [greeter_client.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_client.cc).
-
-The server implementation is at [greeter_server.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_server.cc).
-
-### Try it!
-Build client and server:
-```sh
-$ make
-```
-Run the server, which will listen on port 50051:
-```sh
-$ ./greeter_server
-```
-Run the client (in a different terminal):
-```sh
-$ ./greeter_client
-```
-If things go smoothly, you will see the "Greeter received: Hello world" in the client side output.
-
-## Tutorial
-
-You can find a more detailed tutorial in [gRPC Basics: C++](https://github.com/grpc/grpc-common/blob/master/cpp/cpptutorial.md)
diff --git a/cpp/cpptutorial.md b/cpp/cpptutorial.md
deleted file mode 100644
index c19b472..0000000
--- a/cpp/cpptutorial.md
+++ /dev/null
@@ -1,365 +0,0 @@
-#gRPC Basics: C++
-
-This tutorial provides a basic C++ programmer's introduction to working with gRPC. By walking through this example you'll learn how to:
-
-- Define a service in a .proto file.
-- Generate server and client code using the protocol buffer compiler.
-- Use the C++ gRPC API to write a simple client and server for your service.
-
-It assumes that you have read the [Getting started](https://github.com/grpc/grpc-common) guide and are familiar with [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). Note that the example in this tutorial uses the proto3 version of the protocol buffers language, which is currently in alpha release: you can find out more in the [proto3 language guide](https://developers.google.com/protocol-buffers/docs/proto3) and see the [release notes](https://github.com/google/protobuf/releases) for the new version in the protocol buffers Github repository.
-
-This isn't a comprehensive guide to using gRPC in C++: more reference documentation is coming soon.
-
-## Why use gRPC?
-
-Our example is a simple route mapping application that lets clients get information about features on their route, create a summary of their route, and exchange route information such as traffic updates with the server and other clients.
-
-With gRPC we can define our service once in a .proto file and implement clients and servers in any of gRPC's supported languages, which in turn can be run in environments ranging from servers inside Google to your own tablet - all the complexity of communication between different languages and environments is handled for you by gRPC. We also get all the advantages of working with protocol buffers, including efficient serialization, a simple IDL, and easy interface updating.
-
-## Example code and setup
-
-The example code for our tutorial is in [grpc/grpc-common/cpp/route_guide](https://github.com/grpc/grpc-common/tree/master/cpp/route_guide). To download the example, clone the `grpc-common` repository by running the following command:
-```shell
-$ git clone https://github.com/grpc/grpc-common.git
-```
-
-Then change your current directory to `grpc-common/cpp/route_guide`:
-```shell
-$ cd grpc-common/cpp/route_guide
-```
-
-You also should have the relevant tools installed to generate the server and client interface code - if you don't already, follow the setup instructions in [the C++ quick start guide](https://github.com/grpc/grpc-common/tree/master/cpp).
-
-
-## Defining the service
-
-Our first step (as you'll know from [Getting started](https://github.com/grpc/grpc-common)) is to define the gRPC *service* and the method *request* and *response* types using [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). You can see the complete .proto file in [`grpc-common/protos/route_guide.proto`](https://github.com/grpc/grpc-common/blob/master/protos/route_guide.proto).
-
-To define a service, you specify a named `service` in your .proto file:
-
-```
-service RouteGuide {
- ...
-}
-```
-
-Then you define `rpc` methods inside your service definition, specifying their request and response types. gRPC lets you define four kinds of service method, all of which are used in the `RouteGuide` service:
-
-- A *simple RPC* where the client sends a request to the server using the stub and waits for a response to come back, just like a normal function call.
-```
- // Obtains the feature at a given position.
- rpc GetFeature(Point) returns (Feature) {}
-```
-
-- A *server-side streaming RPC* where the client sends a request to the server and gets a stream to read a sequence of messages back. The client reads from the returned stream until there are no more messages. As you can see in our example, you specify a server-side streaming method by placing the `stream` keyword before the *response* type.
-```
- // Obtains the Features available within the given Rectangle. Results are
- // streamed rather than returned at once (e.g. in a response message with a
- // repeated field), as the rectangle may cover a large area and contain a
- // huge number of features.
- rpc ListFeatures(Rectangle) returns (stream Feature) {}
-```
-
-- A *client-side streaming RPC* where the client writes a sequence of messages and sends them to the server, again using a provided stream. Once the client has finished writing the messages, it waits for the server to read them all and return its response. You specify a client-side streaming method by placing the `stream` keyword before the *request* type.
-```
- // Accepts a stream of Points on a route being traversed, returning a
- // RouteSummary when traversal is completed.
- rpc RecordRoute(stream Point) returns (RouteSummary) {}
-```
-
-- A *bidirectional streaming RPC* where both sides send a sequence of messages using a read-write stream. The two streams operate independently, so clients and servers can read and write in whatever order they like: for example, the server could wait to receive all the client messages before writing its responses, or it could alternately read a message then write a message, or some other combination of reads and writes. The order of messages in each stream is preserved. You specify this type of method by placing the `stream` keyword before both the request and the response.
-```
- // Accepts a stream of RouteNotes sent while a route is being traversed,
- // while receiving other RouteNotes (e.g. from other users).
- rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
-```
-
-Our .proto file also contains protocol buffer message type definitions for all the request and response types used in our service methods - for example, here's the `Point` message type:
-```
-// Points are represented as latitude-longitude pairs in the E7 representation
-// (degrees multiplied by 10**7 and rounded to the nearest integer).
-// Latitudes should be in the range +/- 90 degrees and longitude should be in
-// the range +/- 180 degrees (inclusive).
-message Point {
- int32 latitude = 1;
- int32 longitude = 2;
-}
-```
-
-
-## Generating client and server code
-
-Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler `protoc` with a special gRPC C++ plugin.
-
-For simplicity, we've provided a [makefile](https://github.com/grpc/grpc-common/blob/master/cpp/route_guide/Makefile) that runs `protoc` for you with the appropriate plugin, input, and output (if you want to run this yourself, make sure you've installed protoc and followed the gRPC code [installation instructions](https://github.com/grpc/grpc/blob/master/INSTALL) first):
-
-```shell
-$ make route_guide.grpc.pb.cc route_guide.pb.cc
-```
-
-which actually runs:
-
-```shell
-$ protoc -I ../../protos --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ../../protos/route_guide.proto
-$ protoc -I ../../protos --cpp_out=. ../../protos/route_guide.proto
-```
-
-Running this command generates the following files in your current directory:
-- `route_guide.pb.h`, the header which declares your generated message classes
-- `route_guide.pb.cc`, which contains the implementation of your message classes
-- `route_guide.grpc.pb.h`, the header which declares your generated service classes
-- `route_guide.grpc.pb.cc`, which contains the implementation of your service classes
-
-These contain:
-- All the protocol buffer code to populate, serialize, and retrieve our request and response message types
-- A class called `RouteGuide` that contains
- - a remote interface type (or *stub*) for clients to call with the methods defined in the `RouteGuide` service.
- - two abstract interfaces for servers to implement, also with the methods defined in the `RouteGuide` service.
-
-
-
-## Creating the server
-
-First let's look at how we create a `RouteGuide` server. If you're only interested in creating gRPC clients, you can skip this section and go straight to [Creating the client](#client) (though you might find it interesting anyway!).
-
-There are two parts to making our `RouteGuide` service do its job:
-- Implementing the service interface generated from our service definition: doing the actual "work" of our service.
-- Running a gRPC server to listen for requests from clients and return the service responses.
-
-You can find our example `RouteGuide` server in [grpc-common/cpp/route_guide/route_guide_server.cc](https://github.com/grpc/grpc-common/blob/master/cpp/route_guide/route_guide_server.cc). Let's take a closer look at how it works.
-
-### Implementing RouteGuide
-
-As you can see, our server has a `RouteGuideImpl` class that implements the generated `RouteGuide::Service` interface:
-
-```cpp
-class RouteGuideImpl final : public RouteGuide::Service {
-...
-}
-```
-In this case we're implementing the *synchronous* version of `RouteGuide`, which provides our default gRPC server behaviour. It's also possible to implement an asynchronous interface, `RouteGuide::AsyncService`, which allows you to further customize your server's threading behaviour, though we won't look at this in this tutorial.
-
-`RouteGuideImpl` implements all our service methods. Let's look at the simplest type first, `GetFeature`, which just gets a `Point` from the client and returns the corresponding feature information from its database in a `Feature`.
-
-```cpp
- Status GetFeature(ServerContext* context, const Point* point,
- Feature* feature) override {
- feature->set_name(GetFeatureName(*point, feature_list_));
- feature->mutable_location()->CopyFrom(*point);
- return Status::OK;
- }
-```
-
-The method is passed a context object for the RPC, the client's `Point` protocol buffer request, and a `Feature` protocol buffer to fill in with the response information. In the method we populate the `Feature` with the appropriate information, and then `return` with an `OK` status to tell gRPC that we've finished dealing with the RPC and that the `Feature` can be returned to the client.
-
-Now let's look at something a bit more complicated - a streaming RPC. `ListFeatures` is a server-side streaming RPC, so we need to send back multiple `Feature`s to our client.
-
-```cpp
- Status ListFeatures(ServerContext* context, const Rectangle* rectangle,
- ServerWriter* writer) override {
- auto lo = rectangle->lo();
- auto hi = rectangle->hi();
- long left = std::min(lo.longitude(), hi.longitude());
- long right = std::max(lo.longitude(), hi.longitude());
- long top = std::max(lo.latitude(), hi.latitude());
- long bottom = std::min(lo.latitude(), hi.latitude());
- for (const Feature& f : feature_list_) {
- if (f.location().longitude() >= left &&
- f.location().longitude() <= right &&
- f.location().latitude() >= bottom &&
- f.location().latitude() <= top) {
- writer->Write(f);
- }
- }
- return Status::OK;
- }
-```
-
-As you can see, instead of getting simple request and response objects in our method parameters, this time we get a request object (the `Rectangle` in which our client wants to find `Feature`s) and a special `ServerWriter` object. In the method, we populate as many `Feature` objects as we need to return, writing them to the `ServerWriter` using its `Write()` method. Finally, as in our simple RPC, we `return Status::OK` to tell gRPC that we've finished writing responses.
-
-If you look at the client-side streaming method `RecordRoute` you'll see it's quite similar, except this time we get a `ServerReader` instead of a request object and a single response. We use the `ServerReader`s `Read()` method to repeatedly read in our client's requests to a request object (in this case a `Point`) until there are no more messages: the server needs to check the return value of `Read()` after each call. If `true`, the stream is still good and it can continue reading; if `false` the message stream has ended.
-
-```cpp
-while (stream->Read(&point)) {
- ...//process client input
-}
-```
-Finally, let's look at our bidirectional streaming RPC `RouteChat()`.
-
-```cpp
- Status RouteChat(ServerContext* context,
- ServerReaderWriter* stream) override {
- std::vector received_notes;
- RouteNote note;
- while (stream->Read(¬e)) {
- for (const RouteNote& n : received_notes) {
- if (n.location().latitude() == note.location().latitude() &&
- n.location().longitude() == note.location().longitude()) {
- stream->Write(n);
- }
- }
- received_notes.push_back(note);
- }
-
- return Status::OK;
- }
-```
-
-This time we get a `ServerReaderWriter` that can be used to read *and* write messages. The syntax for reading and writing here is exactly the same as for our client-streaming and server-streaming methods. Although each side will always get the other's messages in the order they were written, both the client and server can read and write in any order — the streams operate completely independently.
-
-### Starting the server
-
-Once we've implemented all our methods, we also need to start up a gRPC server so that clients can actually use our service. The following snippet shows how we do this for our `RouteGuide` service:
-
-```cpp
-void RunServer(const std::string& db_path) {
- std::string server_address("0.0.0.0:50051");
- RouteGuideImpl service(db_path);
-
- ServerBuilder builder;
- builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
- builder.RegisterService(&service);
- std::unique_ptr server(builder.BuildAndStart());
- std::cout << "Server listening on " << server_address << std::endl;
- server->Wait();
-}
-```
-As you can see, we build and start our server using a `ServerBuilder`. To do this, we:
-
-1. Create an instance of our service implementation class `RouteGuideImpl`.
-2. Create an instance of the factory `ServerBuilder` class.
-3. Specify the address and port we want to use to listen for client requests using the builder's `AddListeningPort()` method.
-4. Register our service implementation with the builder.
-5. Call `BuildAndStart()` on the builder to create and start an RPC server for our service.
-5. Call `Wait()` on the server to do a blocking wait until process is killed or `Shutdown()` is called.
-
-
-## Creating the client
-
-In this section, we'll look at creating a C++ client for our `RouteGuide` service. You can see our complete example client code in [grpc-common/cpp/route_guide/route_guide_client.cc](https://github.com/grpc/grpc-common/blob/master/cpp/route_guide/route_guide_client.cc).
-
-### Creating a stub
-
-To call service methods, we first need to create a *stub*.
-
-First we need to create a gRPC *channel* for our stub, specifying the server address and port we want to connect to and any special channel arguments - in our case we'll use the default `ChannelArguments` and no SSL:
-
-```cpp
-grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(), ChannelArguments());
-```
-
-Now we can use the channel to create our stub using the `NewStub` method provided in the `RouteGuide` class we generated from our .proto.
-
-```cpp
- public:
- RouteGuideClient(std::shared_ptr channel, const std::string& db)
- : stub_(RouteGuide::NewStub(channel)) {
- ...
- }
-```
-
-### Calling service methods
-
-Now let's look at how we call our service methods. Note that in this tutorial we're calling the *blocking/synchronous* versions of each method: this means that the RPC call waits for the server to respond, and will either return a response or raise an exception.
-
-#### Simple RPC
-
-Calling the simple RPC `GetFeature` is nearly as straightforward as calling a local method.
-
-```cpp
- Point point;
- Feature feature;
- point = MakePoint(409146138, -746188906);
- GetOneFeature(point, &feature);
-
-...
-
- bool GetOneFeature(const Point& point, Feature* feature) {
- ClientContext context;
- Status status = stub_->GetFeature(&context, point, feature);
- ...
- }
-```
-
-As you can see, we create and populate a request protocol buffer object (in our case `Point`), and create a response protocol buffer object for the server to fill in. We also create a `ClientContext` object for our call - you can optionally set RPC configuration values on this object, such as deadlines, though for now we'll use the default settings. Note that you cannot reuse this object between calls. Finally, we call the method on the stub, passing it the context, request, and response. If the method returns `OK`, then we can read the response information from the server from our response object.
-
-```cpp
- std::cout << "Found feature called " << feature->name() << " at "
- << feature->location().latitude()/kCoordFactor_ << ", "
- << feature->location().longitude()/kCoordFactor_ << std::endl;
-```
-
-#### Streaming RPCs
-
-Now let's look at our streaming methods. If you've already read [Creating the server](#server) some of this may look very familiar - streaming RPCs are implemented in a similar way on both sides. Here's where we call the server-side streaming method `ListFeatures`, which returns a stream of geographical `Feature`s:
-
-```cpp
- std::unique_ptr > reader(
- stub_->ListFeatures(&context, rect));
- while (reader->Read(&feature)) {
- std::cout << "Found feature called "
- << feature.name() << " at "
- << feature.location().latitude()/kCoordFactor_ << ", "
- << feature.location().longitude()/kCoordFactor_ << std::endl;
- }
- Status status = reader->Finish();
-```
-
-Instead of passing the method a context, request, and response, we pass it a context and request and get a `ClientReader` object back. The client can use the `ClientReader` to read the server's responses. We use the `ClientReader`s `Read()` method to repeatedly read in the server's responses to a response protocol buffer object (in this case a `Feature`) until there are no more messages: the client needs to check the return value of `Read()` after each call. If `true`, the stream is still good and it can continue reading; if `false` the message stream has ended. Finally, we call `Finish()` on the stream to complete the call and get our RPC status.
-
-The client-side streaming method `RecordRoute` is similar, except there we pass the method a context and response object and get back a `ClientWriter`.
-
-```cpp
- std::unique_ptr > writer(
- stub_->RecordRoute(&context, &stats));
- for (int i = 0; i < kPoints; i++) {
- const Feature& f = feature_list_[feature_distribution(generator)];
- std::cout << "Visiting point "
- << f.location().latitude()/kCoordFactor_ << ", "
- << f.location().longitude()/kCoordFactor_ << std::endl;
- if (!writer->Write(f.location())) {
- // Broken stream.
- break;
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(
- delay_distribution(generator)));
- }
- writer->WritesDone();
- Status status = writer->Finish();
- if (status.IsOk()) {
- std::cout << "Finished trip with " << stats.point_count() << " points\n"
- << "Passed " << stats.feature_count() << " features\n"
- << "Travelled " << stats.distance() << " meters\n"
- << "It took " << stats.elapsed_time() << " seconds"
- << std::endl;
- } else {
- std::cout << "RecordRoute rpc failed." << std::endl;
- }
-```
-
-Once we've finished writing our client's requests to the stream using `Write()`, we need to call `WritesDone()` on the stream to let gRPC know that we've finished writing, then `Finish()` to complete the call and get our RPC status. If the status is `OK`, our response object that we initially passed to `RecordRoute()` will be populated with the server's response.
-
-Finally, let's look at our bidirectional streaming RPC `RouteChat()`. In this case, we just pass a context to the method and get back a `ClientReaderWriter`, which we can use to both write and read messages.
-
-```cpp
- std::shared_ptr > stream(
- stub_->RouteChat(&context));
-```
-
-The syntax for reading and writing here is exactly the same as for our client-streaming and server-streaming methods. Although each side will always get the other's messages in the order they were written, both the client and server can read and write in any order — the streams operate completely independently.
-
-## Try it out!
-
-Build client and server:
-```shell
-$ make
-```
-Run the server, which will listen on port 50051:
-```shell
-$ ./route_guide_server
-```
-Run the client (in a different terminal):
-```shell
-$ ./route_guide_client
-```
-
diff --git a/cpp/helloworld/Makefile b/cpp/helloworld/Makefile
deleted file mode 100644
index f2093af..0000000
--- a/cpp/helloworld/Makefile
+++ /dev/null
@@ -1,119 +0,0 @@
-#
-# Copyright 2015, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-CXX = g++
-CPPFLAGS += -I/usr/local/include -pthread
-CXXFLAGS += -std=c++11
-LDFLAGS += -L/usr/local/lib -lgrpc++_unsecure -lgrpc -lgpr -lprotobuf -lpthread -ldl
-PROTOC = protoc
-GRPC_CPP_PLUGIN = grpc_cpp_plugin
-GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
-
-PROTOS_PATH = ../../protos
-
-vpath %.proto $(PROTOS_PATH)
-
-all: system-check greeter_client greeter_server greeter_async_client greeter_async_server
-
-greeter_client: helloworld.pb.o helloworld.grpc.pb.o greeter_client.o
- $(CXX) $^ $(LDFLAGS) -o $@
-
-greeter_server: helloworld.pb.o helloworld.grpc.pb.o greeter_server.o
- $(CXX) $^ $(LDFLAGS) -o $@
-
-greeter_async_client: helloworld.pb.o helloworld.grpc.pb.o greeter_async_client.o
- $(CXX) $^ $(LDFLAGS) -o $@
-
-greeter_async_server: helloworld.pb.o helloworld.grpc.pb.o greeter_async_server.o
- $(CXX) $^ $(LDFLAGS) -o $@
-
-%.grpc.pb.cc: %.proto
- $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
-
-%.pb.cc: %.proto
- $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
-
-clean:
- rm -f *.o *.pb.cc *.pb.h greeter_client greeter_server greeter_async_client greeter_async_server
-
-
-# The following is to test your system and ensure a smoother experience.
-# They are by no means necessary to actually compile a grpc-enabled software.
-
-PROTOC_CMD = which $(PROTOC)
-PROTOC_CHECK_CMD = $(PROTOC) --version | grep -q libprotoc.3
-PLUGIN_CHECK_CMD = which $(GRPC_CPP_PLUGIN)
-HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
-ifeq ($(HAS_PROTOC),true)
-HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
-endif
-HAS_PLUGIN = $(shell $(PLUGIN_CHECK_CMD) > /dev/null && echo true || echo false)
-
-SYSTEM_OK = false
-ifeq ($(HAS_VALID_PROTOC),true)
-ifeq ($(HAS_PLUGIN),true)
-SYSTEM_OK = true
-endif
-endif
-
-system-check:
-ifneq ($(HAS_VALID_PROTOC),true)
- @echo " DEPENDENCY ERROR"
- @echo
- @echo "You don't have protoc 3.0.0 installed in your path."
- @echo "Please install Google protocol buffers 3.0.0 and its compiler."
- @echo "You can find it here:"
- @echo
- @echo " https://github.com/google/protobuf/releases/tag/v3.0.0-alpha-1"
- @echo
- @echo "Here is what I get when trying to evaluate your version of protoc:"
- @echo
- -$(PROTOC) --version
- @echo
- @echo
-endif
-ifneq ($(HAS_PLUGIN),true)
- @echo " DEPENDENCY ERROR"
- @echo
- @echo "You don't have the grpc c++ protobuf plugin installed in your path."
- @echo "Please install grpc. You can find it here:"
- @echo
- @echo " https://github.com/grpc/grpc"
- @echo
- @echo "Here is what I get when trying to detect if you have the plugin:"
- @echo
- -which $(GRPC_CPP_PLUGIN)
- @echo
- @echo
-endif
-ifneq ($(SYSTEM_OK),true)
- @false
-endif
diff --git a/cpp/helloworld/README.md b/cpp/helloworld/README.md
deleted file mode 100644
index c406051..0000000
--- a/cpp/helloworld/README.md
+++ /dev/null
@@ -1,260 +0,0 @@
-# gRPC C++ Hello World Tutorial
-
-### Install gRPC
-Make sure you have installed gRPC on your system. Follow the instructions here:
-[https://github.com/grpc/grpc/blob/master/INSTALL](https://github.com/grpc/grpc/blob/master/INSTALL).
-
-### Get the tutorial source code
-
-The example code for this and our other examples lives in the `grpc-common`
-GitHub repository. Clone this repository to your local machine by running the
-following command:
-
-
-```sh
-$ git clone https://github.com/grpc/grpc-common.git
-```
-
-Change your current directory to grpc-common/cpp/helloworld
-
-```sh
-$ cd grpc-common/cpp/helloworld/
-```
-
-### Defining a service
-
-The first step in creating our example is to define a *service*: an RPC
-service specifies the methods that can be called remotely with their parameters
-and return types. As you saw in the
-[overview](#protocolbuffers) above, gRPC does this using [protocol
-buffers](https://developers.google.com/protocol-buffers/docs/overview). We
-use the protocol buffers interface definition language (IDL) to define our
-service methods, and define the parameters and return
-types as protocol buffer message types. Both the client and the
-server use interface code generated from the service definition.
-
-Here's our example service definition, defined using protocol buffers IDL in
-[helloworld.proto](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto). The `Greeting`
-service has one method, `hello`, that lets the server receive a single
-`HelloRequest`
-message from the remote client containing the user's name, then send back
-a greeting in a single `HelloReply`. This is the simplest type of RPC you
-can specify in gRPC - we'll look at some other types later in this document.
-
-```
-syntax = "proto3";
-
-option java_package = "ex.grpc";
-
-package helloworld;
-
-// The greeting service definition.
-service Greeter {
- // Sends a greeting
- rpc SayHello (HelloRequest) returns (HelloReply) {}
-}
-
-// The request message containing the user's name.
-message HelloRequest {
- string name = 1;
-}
-
-// The response message containing the greetings
-message HelloReply {
- string message = 1;
-}
-
-```
-
-
-### Generating gRPC code
-
-Once we've defined our service, we use the protocol buffer compiler
-`protoc` to generate the special client and server code we need to create
-our application. The generated code contains both stub code for clients to
-use and an abstract interface for servers to implement, both with the method
-defined in our `Greeting` service.
-
-To generate the client and server side interfaces:
-
-```sh
-$ make helloworld.grpc.pb.cc helloworld.pb.cc
-```
-Which internally invokes the proto-compiler as:
-
-```sh
-$ protoc -I ../../protos/ --grpc_out=. --plugin=protoc-gen-grpc=grpc_cpp_plugin ../../protos/helloworld.proto
-$ protoc -I ../../protos/ --cpp_out=. ../../protos/helloworld.proto
-```
-
-### Writing a client
-
-- Create a channel. A channel is a logical connection to an endpoint. A gRPC
- channel can be created with the target address, credentials to use and
- arguments as follows
-
- ```
- auto channel = CreateChannel("localhost:50051", InsecureCredentials(), ChannelArguments());
- ```
-
-- Create a stub. A stub implements the rpc methods of a service and in the
- generated code, a method is provided to created a stub with a channel:
-
- ```
- auto stub = helloworld::Greeter::NewStub(channel);
- ```
-
-- Make a unary rpc, with `ClientContext` and request/response proto messages.
-
- ```
- ClientContext context;
- HelloRequest request;
- request.set_name("hello");
- HelloReply reply;
- Status status = stub->SayHello(&context, request, &reply);
- ```
-
-- Check returned status and response.
-
- ```
- if (status.ok()) {
- // check reply.message()
- } else {
- // rpc failed.
- }
- ```
-
-For a working example, refer to [greeter_client.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_client.cc).
-
-### Writing a server
-
-- Implement the service interface
-
- ```
- class GreeterServiceImpl final : public Greeter::Service {
- Status SayHello(ServerContext* context, const HelloRequest* request,
- HelloReply* reply) override {
- std::string prefix("Hello ");
- reply->set_message(prefix + request->name());
- return Status::OK;
- }
- };
-
- ```
-
-- Build a server exporting the service
-
- ```
- GreeterServiceImpl service;
- ServerBuilder builder;
- builder.AddListeningPort("0.0.0.0:50051", grpc::InsecureServerCredentials());
- builder.RegisterService(&service);
- std::unique_ptr server(builder.BuildAndStart());
- ```
-
-For a working example, refer to [greeter_server.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_server.cc).
-
-### Writing asynchronous client and server
-
-gRPC uses `CompletionQueue` API for asynchronous operations. The basic work flow
-is
-- bind a `CompletionQueue` to a rpc call
-- do something like a read or write, present with a unique `void*` tag
-- call `CompletionQueue::Next` to wait for operations to complete. If a tag
- appears, it indicates that the corresponding operation is complete.
-
-#### Async client
-
-The channel and stub creation code is the same as the sync client.
-
-- Initiate the rpc and create a handle for the rpc. Bind the rpc to a
- `CompletionQueue`.
-
- ```
- CompletionQueue cq;
- auto rpc = stub->AsyncSayHello(&context, request, &cq);
- ```
-
-- Ask for reply and final status, with a unique tag
-
- ```
- Status status;
- rpc->Finish(&reply, &status, (void*)1);
- ```
-
-- Wait for the completion queue to return the next tag. The reply and status are
- ready once the tag passed into the corresponding `Finish()` call is returned.
-
- ```
- void* got_tag;
- bool ok = false;
- cq.Next(&got_tag, &ok);
- if (ok && got_tag == (void*)1) {
- // check reply and status
- }
- ```
-
-For a working example, refer to [greeter_async_client.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_async_client.cc).
-
-#### Async server
-
-The server implementation requests a rpc call with a tag and then wait for the
-completion queue to return the tag. The basic flow is
-
-- Build a server exporting the async service
-
- ```
- helloworld::Greeter::AsyncService service;
- ServerBuilder builder;
- builder.AddListeningPort("0.0.0.0:50051", InsecureServerCredentials());
- builder.RegisterAsyncService(&service);
- auto cq = builder.AddCompletionQueue();
- auto server = builder.BuildAndStart();
- ```
-
-- Request one rpc
-
- ```
- ServerContext context;
- HelloRequest request;
- ServerAsyncResponseWriter responder;
- service.RequestSayHello(&context, &request, &responder, &cq, &cq, (void*)1);
- ```
-
-- Wait for the completion queue to return the tag. The context, request and
- responder are ready once the tag is retrieved.
-
- ```
- HelloReply reply;
- Status status;
- void* got_tag;
- bool ok = false;
- cq.Next(&got_tag, &ok);
- if (ok && got_tag == (void*)1) {
- // set reply and status
- responder.Finish(reply, status, (void*)2);
- }
- ```
-
-- Wait for the completion queue to return the tag. The rpc is finished when the
- tag is back.
-
- ```
- void* got_tag;
- bool ok = false;
- cq.Next(&got_tag, &ok);
- if (ok && got_tag == (void*)2) {
- // clean up
- }
- ```
-
-To handle multiple rpcs, the async server creates an object `CallData` to
-maintain the state of each rpc and use the address of it as the unique tag. For
-simplicity the server only uses one completion queue for all events, and runs a
-main loop in `HandleRpcs` to query the queue.
-
-For a working example, refer to [greeter_async_server.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_async_server.cc).
-
-
-
-
diff --git a/cpp/helloworld/greeter_async_client.cc b/cpp/helloworld/greeter_async_client.cc
deleted file mode 100644
index d99f89b..0000000
--- a/cpp/helloworld/greeter_async_client.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "helloworld.grpc.pb.h"
-
-using grpc::Channel;
-using grpc::ChannelArguments;
-using grpc::ClientAsyncResponseReader;
-using grpc::ClientContext;
-using grpc::CompletionQueue;
-using grpc::Status;
-using helloworld::HelloRequest;
-using helloworld::HelloReply;
-using helloworld::Greeter;
-
-class GreeterClient {
- public:
- explicit GreeterClient(std::shared_ptr channel)
- : stub_(Greeter::NewStub(channel)) {}
-
- std::string SayHello(const std::string& user) {
- HelloRequest request;
- request.set_name(user);
- HelloReply reply;
- ClientContext context;
- CompletionQueue cq;
- Status status;
-
- std::unique_ptr > rpc(
- stub_->AsyncSayHello(&context, request, &cq));
- rpc->Finish(&reply, &status, (void*)1);
- void* got_tag;
- bool ok = false;
- cq.Next(&got_tag, &ok);
- GPR_ASSERT(ok);
- GPR_ASSERT(got_tag == (void*)1);
-
- if (status.ok()) {
- return reply.message();
- } else {
- return "Rpc failed";
- }
- }
-
- private:
- std::unique_ptr stub_;
-};
-
-int main(int argc, char** argv) {
- GreeterClient greeter(grpc::CreateChannel(
- "localhost:50051", grpc::InsecureCredentials(), ChannelArguments()));
- std::string user("world");
- std::string reply = greeter.SayHello(user);
- std::cout << "Greeter received: " << reply << std::endl;
-
- return 0;
-}
diff --git a/cpp/helloworld/greeter_async_server.cc b/cpp/helloworld/greeter_async_server.cc
deleted file mode 100644
index b8a0dbf..0000000
--- a/cpp/helloworld/greeter_async_server.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "helloworld.grpc.pb.h"
-
-using grpc::Server;
-using grpc::ServerAsyncResponseWriter;
-using grpc::ServerBuilder;
-using grpc::ServerContext;
-using grpc::ServerCompletionQueue;
-using grpc::Status;
-using helloworld::HelloRequest;
-using helloworld::HelloReply;
-using helloworld::Greeter;
-
-class ServerImpl final {
- public:
- ~ServerImpl() {
- server_->Shutdown();
- cq_->Shutdown();
- }
-
- // There is no shutdown handling in this code.
- void Run() {
- std::string server_address("0.0.0.0:50051");
-
- ServerBuilder builder;
- builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
- builder.RegisterAsyncService(&service_);
- cq_ = builder.AddCompletionQueue();
- server_ = builder.BuildAndStart();
- std::cout << "Server listening on " << server_address << std::endl;
-
- HandleRpcs();
- }
-
- private:
- class CallData {
- public:
- CallData(Greeter::AsyncService* service, ServerCompletionQueue* cq)
- : service_(service), cq_(cq), responder_(&ctx_), status_(CREATE) {
- Proceed();
- }
-
- void Proceed() {
- if (status_ == CREATE) {
- service_->RequestSayHello(&ctx_, &request_, &responder_, cq_, cq_,
- this);
- status_ = PROCESS;
- } else if (status_ == PROCESS) {
- new CallData(service_, cq_);
- std::string prefix("Hello ");
- reply_.set_message(prefix + request_.name());
- responder_.Finish(reply_, Status::OK, this);
- status_ = FINISH;
- } else {
- delete this;
- }
- }
-
- private:
- Greeter::AsyncService* service_;
- ServerCompletionQueue* cq_;
- ServerContext ctx_;
- HelloRequest request_;
- HelloReply reply_;
- ServerAsyncResponseWriter responder_;
- enum CallStatus { CREATE, PROCESS, FINISH };
- CallStatus status_;
- };
-
- // This can be run in multiple threads if needed.
- void HandleRpcs() {
- new CallData(&service_, cq_.get());
- void* tag;
- bool ok;
- while (true) {
- cq_->Next(&tag, &ok);
- GPR_ASSERT(ok);
- static_cast(tag)->Proceed();
- }
- }
-
- std::unique_ptr cq_;
- Greeter::AsyncService service_;
- std::unique_ptr server_;
-};
-
-int main(int argc, char** argv) {
- ServerImpl server;
- server.Run();
-
- return 0;
-}
diff --git a/cpp/helloworld/greeter_client.cc b/cpp/helloworld/greeter_client.cc
deleted file mode 100644
index dd0358a..0000000
--- a/cpp/helloworld/greeter_client.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include "helloworld.grpc.pb.h"
-
-using grpc::Channel;
-using grpc::ChannelArguments;
-using grpc::ClientContext;
-using grpc::Status;
-using helloworld::HelloRequest;
-using helloworld::HelloReply;
-using helloworld::Greeter;
-
-class GreeterClient {
- public:
- GreeterClient(std::shared_ptr channel)
- : stub_(Greeter::NewStub(channel)) {}
-
- std::string SayHello(const std::string& user) {
- HelloRequest request;
- request.set_name(user);
- HelloReply reply;
- ClientContext context;
-
- Status status = stub_->SayHello(&context, request, &reply);
- if (status.ok()) {
- return reply.message();
- } else {
- return "Rpc failed";
- }
- }
-
- private:
- std::unique_ptr stub_;
-};
-
-int main(int argc, char** argv) {
- GreeterClient greeter(
- grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(),
- ChannelArguments()));
- std::string user("world");
- std::string reply = greeter.SayHello(user);
- std::cout << "Greeter received: " << reply << std::endl;
-
- return 0;
-}
diff --git a/cpp/helloworld/greeter_server.cc b/cpp/helloworld/greeter_server.cc
deleted file mode 100644
index c1efdf5..0000000
--- a/cpp/helloworld/greeter_server.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include "helloworld.grpc.pb.h"
-
-using grpc::Server;
-using grpc::ServerBuilder;
-using grpc::ServerContext;
-using grpc::Status;
-using helloworld::HelloRequest;
-using helloworld::HelloReply;
-using helloworld::Greeter;
-
-class GreeterServiceImpl final : public Greeter::Service {
- Status SayHello(ServerContext* context, const HelloRequest* request,
- HelloReply* reply) override {
- std::string prefix("Hello ");
- reply->set_message(prefix + request->name());
- return Status::OK;
- }
-};
-
-void RunServer() {
- std::string server_address("0.0.0.0:50051");
- GreeterServiceImpl service;
-
- ServerBuilder builder;
- builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
- builder.RegisterService(&service);
- std::unique_ptr server(builder.BuildAndStart());
- std::cout << "Server listening on " << server_address << std::endl;
- server->Wait();
-}
-
-int main(int argc, char** argv) {
- RunServer();
-
- return 0;
-}
diff --git a/cpp/route_guide/Makefile b/cpp/route_guide/Makefile
deleted file mode 100644
index b906177..0000000
--- a/cpp/route_guide/Makefile
+++ /dev/null
@@ -1,113 +0,0 @@
-#
-# Copyright 2015, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-CXX = g++
-CPPFLAGS += -I/usr/local/include -pthread
-CXXFLAGS += -std=c++11
-LDFLAGS += -L/usr/local/lib -lgrpc++_unsecure -lgrpc -lgpr -lprotobuf -lpthread -ldl
-PROTOC = protoc
-GRPC_CPP_PLUGIN = grpc_cpp_plugin
-GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
-
-PROTOS_PATH = ../../protos
-
-vpath %.proto $(PROTOS_PATH)
-
-all: system-check route_guide_client route_guide_server
-
-route_guide_client: route_guide.pb.o route_guide.grpc.pb.o route_guide_client.o helper.o
- $(CXX) $^ $(LDFLAGS) -o $@
-
-route_guide_server: route_guide.pb.o route_guide.grpc.pb.o route_guide_server.o helper.o
- $(CXX) $^ $(LDFLAGS) -o $@
-
-%.grpc.pb.cc: %.proto
- $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
-
-%.pb.cc: %.proto
- $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
-
-clean:
- rm -f *.o *.pb.cc *.pb.h route_guide_client route_guide_server
-
-
-# The following is to test your system and ensure a smoother experience.
-# They are by no means necessary to actually compile a grpc-enabled software.
-
-PROTOC_CMD = which $(PROTOC)
-PROTOC_CHECK_CMD = $(PROTOC) --version | grep -q libprotoc.3
-PLUGIN_CHECK_CMD = which $(GRPC_CPP_PLUGIN)
-HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
-ifeq ($(HAS_PROTOC),true)
-HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
-endif
-HAS_PLUGIN = $(shell $(PLUGIN_CHECK_CMD) > /dev/null && echo true || echo false)
-
-SYSTEM_OK = false
-ifeq ($(HAS_VALID_PROTOC),true)
-ifeq ($(HAS_PLUGIN),true)
-SYSTEM_OK = true
-endif
-endif
-
-system-check:
-ifneq ($(HAS_VALID_PROTOC),true)
- @echo " DEPENDENCY ERROR"
- @echo
- @echo "You don't have protoc 3.0.0 installed in your path."
- @echo "Please install Google protocol buffers 3.0.0 and its compiler."
- @echo "You can find it here:"
- @echo
- @echo " https://github.com/google/protobuf/releases/tag/v3.0.0-alpha-1"
- @echo
- @echo "Here is what I get when trying to evaluate your version of protoc:"
- @echo
- -$(PROTOC) --version
- @echo
- @echo
-endif
-ifneq ($(HAS_PLUGIN),true)
- @echo " DEPENDENCY ERROR"
- @echo
- @echo "You don't have the grpc c++ protobuf plugin installed in your path."
- @echo "Please install grpc. You can find it here:"
- @echo
- @echo " https://github.com/grpc/grpc"
- @echo
- @echo "Here is what I get when trying to detect if you have the plugin:"
- @echo
- -which $(GRPC_CPP_PLUGIN)
- @echo
- @echo
-endif
-ifneq ($(SYSTEM_OK),true)
- @false
-endif
diff --git a/cpp/route_guide/helper.cc b/cpp/route_guide/helper.cc
deleted file mode 100644
index c2415af..0000000
--- a/cpp/route_guide/helper.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "route_guide.grpc.pb.h"
-
-namespace examples {
-
-std::string GetDbFileContent(int argc, char** argv) {
- std::string db_path;
- std::string arg_str("--db_path");
- if (argc > 1) {
- std::string argv_1 = argv[1];
- size_t start_position = argv_1.find(arg_str);
- if (start_position != std::string::npos) {
- start_position += arg_str.size();
- if (argv_1[start_position] == ' ' ||
- argv_1[start_position] == '=') {
- db_path = argv_1.substr(start_position + 1);
- }
- }
- } else {
- db_path = "route_guide_db.json";
- }
- std::ifstream db_file(db_path);
- if (!db_file.is_open()) {
- std::cout << "Failed to open " << db_path << std::endl;
- return "";
- }
- std::stringstream db;
- db << db_file.rdbuf();
- return db.str();
-}
-
-// A simple parser for the json db file. It requires the db file to have the
-// exact form of [{"location": { "latitude": 123, "longitude": 456}, "name":
-// "the name can be empty" }, { ... } ... The spaces will be stripped.
-class Parser {
- public:
- explicit Parser(const std::string& db) : db_(db) {
- // Remove all spaces.
- db_.erase(
- std::remove_if(db_.begin(), db_.end(), isspace),
- db_.end());
- if (!Match("[")) {
- SetFailedAndReturnFalse();
- }
- }
-
- bool Finished() {
- return current_ >= db_.size();
- }
-
- bool TryParseOne(Feature* feature) {
- if (failed_ || Finished() || !Match("{")) {
- return SetFailedAndReturnFalse();
- }
- if (!Match(location_) || !Match("{") || !Match(latitude_)) {
- return SetFailedAndReturnFalse();
- }
- long temp = 0;
- ReadLong(&temp);
- feature->mutable_location()->set_latitude(temp);
- if (!Match(",") || !Match(longitude_)) {
- return SetFailedAndReturnFalse();
- }
- ReadLong(&temp);
- feature->mutable_location()->set_longitude(temp);
- if (!Match("},") || !Match(name_) || !Match("\"")) {
- return SetFailedAndReturnFalse();
- }
- size_t name_start = current_;
- while (current_ != db_.size() && db_[current_++] != '"') {
- }
- if (current_ == db_.size()) {
- return SetFailedAndReturnFalse();
- }
- feature->set_name(db_.substr(name_start, current_-name_start-1));
- if (!Match("},")) {
- if (db_[current_ - 1] == ']' && current_ == db_.size()) {
- return true;
- }
- return SetFailedAndReturnFalse();
- }
- return true;
- }
-
- private:
-
- bool SetFailedAndReturnFalse() {
- failed_ = true;
- return false;
- }
-
- bool Match(const std::string& prefix) {
- bool eq = db_.substr(current_, prefix.size()) == prefix;
- current_ += prefix.size();
- return eq;
- }
-
- void ReadLong(long* l) {
- size_t start = current_;
- while (current_ != db_.size() && db_[current_] != ',' && db_[current_] != '}') {
- current_++;
- }
- // It will throw an exception if fails.
- *l = std::stol(db_.substr(start, current_ - start));
- }
-
- bool failed_ = false;
- std::string db_;
- size_t current_ = 0;
- const std::string location_ = "\"location\":";
- const std::string latitude_ = "\"latitude\":";
- const std::string longitude_ = "\"longitude\":";
- const std::string name_ = "\"name\":";
-};
-
-void ParseDb(const std::string& db, std::vector* feature_list) {
- feature_list->clear();
- std::string db_content(db);
- db_content.erase(
- std::remove_if(db_content.begin(), db_content.end(), isspace),
- db_content.end());
-
- Parser parser(db_content);
- Feature feature;
- while (!parser.Finished()) {
- feature_list->push_back(Feature());
- if (!parser.TryParseOne(&feature_list->back())) {
- std::cout << "Error parsing the db file";
- feature_list->clear();
- break;
- }
- }
- std::cout << "DB parsed, loaded " << feature_list->size()
- << " features." << std::endl;
-}
-
-
-} // namespace examples
-
diff --git a/cpp/route_guide/helper.h b/cpp/route_guide/helper.h
deleted file mode 100644
index 65c93c1..0000000
--- a/cpp/route_guide/helper.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef GRPC_COMMON_CPP_ROUTE_GUIDE_HELPER_H_
-#define GRPC_COMMON_CPP_ROUTE_GUIDE_HELPER_H_
-
-#include
-#include
-
-namespace examples {
-class Feature;
-
-std::string GetDbFileContent(int argc, char** argv);
-
-void ParseDb(const std::string& db, std::vector* feature_list);
-
-} // namespace examples
-
-#endif // GRPC_COMMON_CPP_ROUTE_GUIDE_HELPER_H_
-
diff --git a/cpp/route_guide/route_guide_client.cc b/cpp/route_guide/route_guide_client.cc
deleted file mode 100644
index 814def2..0000000
--- a/cpp/route_guide/route_guide_client.cc
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include "helper.h"
-#include "route_guide.grpc.pb.h"
-
-using grpc::Channel;
-using grpc::ChannelArguments;
-using grpc::ClientContext;
-using grpc::ClientReader;
-using grpc::ClientReaderWriter;
-using grpc::ClientWriter;
-using grpc::Status;
-using examples::Point;
-using examples::Feature;
-using examples::Rectangle;
-using examples::RouteSummary;
-using examples::RouteNote;
-using examples::RouteGuide;
-
-Point MakePoint(long latitude, long longitude) {
- Point p;
- p.set_latitude(latitude);
- p.set_longitude(longitude);
- return p;
-}
-
-Feature MakeFeature(const std::string& name,
- long latitude, long longitude) {
- Feature f;
- f.set_name(name);
- f.mutable_location()->CopyFrom(MakePoint(latitude, longitude));
- return f;
-}
-
-RouteNote MakeRouteNote(const std::string& message,
- long latitude, long longitude) {
- RouteNote n;
- n.set_message(message);
- n.mutable_location()->CopyFrom(MakePoint(latitude, longitude));
- return n;
-}
-
-class RouteGuideClient {
- public:
- RouteGuideClient(std::shared_ptr channel, const std::string& db)
- : stub_(RouteGuide::NewStub(channel)) {
- examples::ParseDb(db, &feature_list_);
- }
-
- void GetFeature() {
- Point point;
- Feature feature;
- point = MakePoint(409146138, -746188906);
- GetOneFeature(point, &feature);
- point = MakePoint(0, 0);
- GetOneFeature(point, &feature);
- }
-
- void ListFeatures() {
- examples::Rectangle rect;
- Feature feature;
- ClientContext context;
-
- rect.mutable_lo()->set_latitude(400000000);
- rect.mutable_lo()->set_longitude(-750000000);
- rect.mutable_hi()->set_latitude(420000000);
- rect.mutable_hi()->set_longitude(-730000000);
- std::cout << "Looking for features between 40, -75 and 42, -73"
- << std::endl;
-
- std::unique_ptr > reader(
- stub_->ListFeatures(&context, rect));
- while (reader->Read(&feature)) {
- std::cout << "Found feature called "
- << feature.name() << " at "
- << feature.location().latitude()/kCoordFactor_ << ", "
- << feature.location().longitude()/kCoordFactor_ << std::endl;
- }
- Status status = reader->Finish();
- if (status.ok()) {
- std::cout << "ListFeatures rpc succeeded." << std::endl;
- } else {
- std::cout << "ListFeatures rpc failed." << std::endl;
- }
- }
-
- void RecordRoute() {
- Point point;
- RouteSummary stats;
- ClientContext context;
- const int kPoints = 10;
- unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
-
- std::default_random_engine generator(seed);
- std::uniform_int_distribution feature_distribution(
- 0, feature_list_.size() - 1);
- std::uniform_int_distribution delay_distribution(
- 500, 1500);
-
- std::unique_ptr > writer(
- stub_->RecordRoute(&context, &stats));
- for (int i = 0; i < kPoints; i++) {
- const Feature& f = feature_list_[feature_distribution(generator)];
- std::cout << "Visiting point "
- << f.location().latitude()/kCoordFactor_ << ", "
- << f.location().longitude()/kCoordFactor_ << std::endl;
- if (!writer->Write(f.location())) {
- // Broken stream.
- break;
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(
- delay_distribution(generator)));
- }
- writer->WritesDone();
- Status status = writer->Finish();
- if (status.ok()) {
- std::cout << "Finished trip with " << stats.point_count() << " points\n"
- << "Passed " << stats.feature_count() << " features\n"
- << "Travelled " << stats.distance() << " meters\n"
- << "It took " << stats.elapsed_time() << " seconds"
- << std::endl;
- } else {
- std::cout << "RecordRoute rpc failed." << std::endl;
- }
- }
-
- void RouteChat() {
- ClientContext context;
-
- std::shared_ptr > stream(
- stub_->RouteChat(&context));
-
- std::thread writer([stream]() {
- std::vector notes{
- MakeRouteNote("First message", 0, 0),
- MakeRouteNote("Second message", 0, 1),
- MakeRouteNote("Third message", 1, 0),
- MakeRouteNote("Fourth message", 0, 0)};
- for (const RouteNote& note : notes) {
- std::cout << "Sending message " << note.message()
- << " at " << note.location().latitude() << ", "
- << note.location().longitude() << std::endl;
- stream->Write(note);
- }
- stream->WritesDone();
- });
-
- RouteNote server_note;
- while (stream->Read(&server_note)) {
- std::cout << "Got message " << server_note.message()
- << " at " << server_note.location().latitude() << ", "
- << server_note.location().longitude() << std::endl;
- }
- writer.join();
- Status status = stream->Finish();
- if (!status.ok()) {
- std::cout << "RouteChat rpc failed." << std::endl;
- }
- }
-
- private:
-
- bool GetOneFeature(const Point& point, Feature* feature) {
- ClientContext context;
- Status status = stub_->GetFeature(&context, point, feature);
- if (!status.ok()) {
- std::cout << "GetFeature rpc failed." << std::endl;
- return false;
- }
- if (!feature->has_location()) {
- std::cout << "Server returns incomplete feature." << std::endl;
- return false;
- }
- if (feature->name().empty()) {
- std::cout << "Found no feature at "
- << feature->location().latitude()/kCoordFactor_ << ", "
- << feature->location().longitude()/kCoordFactor_ << std::endl;
- } else {
- std::cout << "Found feature called " << feature->name() << " at "
- << feature->location().latitude()/kCoordFactor_ << ", "
- << feature->location().longitude()/kCoordFactor_ << std::endl;
- }
- return true;
- }
-
- const float kCoordFactor_ = 10000000.0;
- std::unique_ptr stub_;
- std::vector feature_list_;
-};
-
-int main(int argc, char** argv) {
- // Expect only arg: --db_path=path/to/route_guide_db.json.
- std::string db = examples::GetDbFileContent(argc, argv);
- RouteGuideClient guide(
- grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(),
- ChannelArguments()),
- db);
-
- std::cout << "-------------- GetFeature --------------" << std::endl;
- guide.GetFeature();
- std::cout << "-------------- ListFeatures --------------" << std::endl;
- guide.ListFeatures();
- std::cout << "-------------- RecordRoute --------------" << std::endl;
- guide.RecordRoute();
- std::cout << "-------------- RouteChat --------------" << std::endl;
- guide.RouteChat();
-
- return 0;
-}
diff --git a/cpp/route_guide/route_guide_db.json b/cpp/route_guide/route_guide_db.json
deleted file mode 100644
index 9d6a980..0000000
--- a/cpp/route_guide/route_guide_db.json
+++ /dev/null
@@ -1,601 +0,0 @@
-[{
- "location": {
- "latitude": 407838351,
- "longitude": -746143763
- },
- "name": "Patriots Path, Mendham, NJ 07945, USA"
-}, {
- "location": {
- "latitude": 408122808,
- "longitude": -743999179
- },
- "name": "101 New Jersey 10, Whippany, NJ 07981, USA"
-}, {
- "location": {
- "latitude": 413628156,
- "longitude": -749015468
- },
- "name": "U.S. 6, Shohola, PA 18458, USA"
-}, {
- "location": {
- "latitude": 419999544,
- "longitude": -740371136
- },
- "name": "5 Conners Road, Kingston, NY 12401, USA"
-}, {
- "location": {
- "latitude": 414008389,
- "longitude": -743951297
- },
- "name": "Mid Hudson Psychiatric Center, New Hampton, NY 10958, USA"
-}, {
- "location": {
- "latitude": 419611318,
- "longitude": -746524769
- },
- "name": "287 Flugertown Road, Livingston Manor, NY 12758, USA"
-}, {
- "location": {
- "latitude": 406109563,
- "longitude": -742186778
- },
- "name": "4001 Tremley Point Road, Linden, NJ 07036, USA"
-}, {
- "location": {
- "latitude": 416802456,
- "longitude": -742370183
- },
- "name": "352 South Mountain Road, Wallkill, NY 12589, USA"
-}, {
- "location": {
- "latitude": 412950425,
- "longitude": -741077389
- },
- "name": "Bailey Turn Road, Harriman, NY 10926, USA"
-}, {
- "location": {
- "latitude": 412144655,
- "longitude": -743949739
- },
- "name": "193-199 Wawayanda Road, Hewitt, NJ 07421, USA"
-}, {
- "location": {
- "latitude": 415736605,
- "longitude": -742847522
- },
- "name": "406-496 Ward Avenue, Pine Bush, NY 12566, USA"
-}, {
- "location": {
- "latitude": 413843930,
- "longitude": -740501726
- },
- "name": "162 Merrill Road, Highland Mills, NY 10930, USA"
-}, {
- "location": {
- "latitude": 410873075,
- "longitude": -744459023
- },
- "name": "Clinton Road, West Milford, NJ 07480, USA"
-}, {
- "location": {
- "latitude": 412346009,
- "longitude": -744026814
- },
- "name": "16 Old Brook Lane, Warwick, NY 10990, USA"
-}, {
- "location": {
- "latitude": 402948455,
- "longitude": -747903913
- },
- "name": "3 Drake Lane, Pennington, NJ 08534, USA"
-}, {
- "location": {
- "latitude": 406337092,
- "longitude": -740122226
- },
- "name": "6324 8th Avenue, Brooklyn, NY 11220, USA"
-}, {
- "location": {
- "latitude": 406421967,
- "longitude": -747727624
- },
- "name": "1 Merck Access Road, Whitehouse Station, NJ 08889, USA"
-}, {
- "location": {
- "latitude": 416318082,
- "longitude": -749677716
- },
- "name": "78-98 Schalck Road, Narrowsburg, NY 12764, USA"
-}, {
- "location": {
- "latitude": 415301720,
- "longitude": -748416257
- },
- "name": "282 Lakeview Drive Road, Highland Lake, NY 12743, USA"
-}, {
- "location": {
- "latitude": 402647019,
- "longitude": -747071791
- },
- "name": "330 Evelyn Avenue, Hamilton Township, NJ 08619, USA"
-}, {
- "location": {
- "latitude": 412567807,
- "longitude": -741058078
- },
- "name": "New York State Reference Route 987E, Southfields, NY 10975, USA"
-}, {
- "location": {
- "latitude": 416855156,
- "longitude": -744420597
- },
- "name": "103-271 Tempaloni Road, Ellenville, NY 12428, USA"
-}, {
- "location": {
- "latitude": 404663628,
- "longitude": -744820157
- },
- "name": "1300 Airport Road, North Brunswick Township, NJ 08902, USA"
-}, {
- "location": {
- "latitude": 407113723,
- "longitude": -749746483
- },
- "name": ""
-}, {
- "location": {
- "latitude": 402133926,
- "longitude": -743613249
- },
- "name": ""
-}, {
- "location": {
- "latitude": 400273442,
- "longitude": -741220915
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411236786,
- "longitude": -744070769
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411633782,
- "longitude": -746784970
- },
- "name": "211-225 Plains Road, Augusta, NJ 07822, USA"
-}, {
- "location": {
- "latitude": 415830701,
- "longitude": -742952812
- },
- "name": ""
-}, {
- "location": {
- "latitude": 413447164,
- "longitude": -748712898
- },
- "name": "165 Pedersen Ridge Road, Milford, PA 18337, USA"
-}, {
- "location": {
- "latitude": 405047245,
- "longitude": -749800722
- },
- "name": "100-122 Locktown Road, Frenchtown, NJ 08825, USA"
-}, {
- "location": {
- "latitude": 418858923,
- "longitude": -746156790
- },
- "name": ""
-}, {
- "location": {
- "latitude": 417951888,
- "longitude": -748484944
- },
- "name": "650-652 Willi Hill Road, Swan Lake, NY 12783, USA"
-}, {
- "location": {
- "latitude": 407033786,
- "longitude": -743977337
- },
- "name": "26 East 3rd Street, New Providence, NJ 07974, USA"
-}, {
- "location": {
- "latitude": 417548014,
- "longitude": -740075041
- },
- "name": ""
-}, {
- "location": {
- "latitude": 410395868,
- "longitude": -744972325
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404615353,
- "longitude": -745129803
- },
- "name": ""
-}, {
- "location": {
- "latitude": 406589790,
- "longitude": -743560121
- },
- "name": "611 Lawrence Avenue, Westfield, NJ 07090, USA"
-}, {
- "location": {
- "latitude": 414653148,
- "longitude": -740477477
- },
- "name": "18 Lannis Avenue, New Windsor, NY 12553, USA"
-}, {
- "location": {
- "latitude": 405957808,
- "longitude": -743255336
- },
- "name": "82-104 Amherst Avenue, Colonia, NJ 07067, USA"
-}, {
- "location": {
- "latitude": 411733589,
- "longitude": -741648093
- },
- "name": "170 Seven Lakes Drive, Sloatsburg, NY 10974, USA"
-}, {
- "location": {
- "latitude": 412676291,
- "longitude": -742606606
- },
- "name": "1270 Lakes Road, Monroe, NY 10950, USA"
-}, {
- "location": {
- "latitude": 409224445,
- "longitude": -748286738
- },
- "name": "509-535 Alphano Road, Great Meadows, NJ 07838, USA"
-}, {
- "location": {
- "latitude": 406523420,
- "longitude": -742135517
- },
- "name": "652 Garden Street, Elizabeth, NJ 07202, USA"
-}, {
- "location": {
- "latitude": 401827388,
- "longitude": -740294537
- },
- "name": "349 Sea Spray Court, Neptune City, NJ 07753, USA"
-}, {
- "location": {
- "latitude": 410564152,
- "longitude": -743685054
- },
- "name": "13-17 Stanley Street, West Milford, NJ 07480, USA"
-}, {
- "location": {
- "latitude": 408472324,
- "longitude": -740726046
- },
- "name": "47 Industrial Avenue, Teterboro, NJ 07608, USA"
-}, {
- "location": {
- "latitude": 412452168,
- "longitude": -740214052
- },
- "name": "5 White Oak Lane, Stony Point, NY 10980, USA"
-}, {
- "location": {
- "latitude": 409146138,
- "longitude": -746188906
- },
- "name": "Berkshire Valley Management Area Trail, Jefferson, NJ, USA"
-}, {
- "location": {
- "latitude": 404701380,
- "longitude": -744781745
- },
- "name": "1007 Jersey Avenue, New Brunswick, NJ 08901, USA"
-}, {
- "location": {
- "latitude": 409642566,
- "longitude": -746017679
- },
- "name": "6 East Emerald Isle Drive, Lake Hopatcong, NJ 07849, USA"
-}, {
- "location": {
- "latitude": 408031728,
- "longitude": -748645385
- },
- "name": "1358-1474 New Jersey 57, Port Murray, NJ 07865, USA"
-}, {
- "location": {
- "latitude": 413700272,
- "longitude": -742135189
- },
- "name": "367 Prospect Road, Chester, NY 10918, USA"
-}, {
- "location": {
- "latitude": 404310607,
- "longitude": -740282632
- },
- "name": "10 Simon Lake Drive, Atlantic Highlands, NJ 07716, USA"
-}, {
- "location": {
- "latitude": 409319800,
- "longitude": -746201391
- },
- "name": "11 Ward Street, Mount Arlington, NJ 07856, USA"
-}, {
- "location": {
- "latitude": 406685311,
- "longitude": -742108603
- },
- "name": "300-398 Jefferson Avenue, Elizabeth, NJ 07201, USA"
-}, {
- "location": {
- "latitude": 419018117,
- "longitude": -749142781
- },
- "name": "43 Dreher Road, Roscoe, NY 12776, USA"
-}, {
- "location": {
- "latitude": 412856162,
- "longitude": -745148837
- },
- "name": "Swan Street, Pine Island, NY 10969, USA"
-}, {
- "location": {
- "latitude": 416560744,
- "longitude": -746721964
- },
- "name": "66 Pleasantview Avenue, Monticello, NY 12701, USA"
-}, {
- "location": {
- "latitude": 405314270,
- "longitude": -749836354
- },
- "name": ""
-}, {
- "location": {
- "latitude": 414219548,
- "longitude": -743327440
- },
- "name": ""
-}, {
- "location": {
- "latitude": 415534177,
- "longitude": -742900616
- },
- "name": "565 Winding Hills Road, Montgomery, NY 12549, USA"
-}, {
- "location": {
- "latitude": 406898530,
- "longitude": -749127080
- },
- "name": "231 Rocky Run Road, Glen Gardner, NJ 08826, USA"
-}, {
- "location": {
- "latitude": 407586880,
- "longitude": -741670168
- },
- "name": "100 Mount Pleasant Avenue, Newark, NJ 07104, USA"
-}, {
- "location": {
- "latitude": 400106455,
- "longitude": -742870190
- },
- "name": "517-521 Huntington Drive, Manchester Township, NJ 08759, USA"
-}, {
- "location": {
- "latitude": 400066188,
- "longitude": -746793294
- },
- "name": ""
-}, {
- "location": {
- "latitude": 418803880,
- "longitude": -744102673
- },
- "name": "40 Mountain Road, Napanoch, NY 12458, USA"
-}, {
- "location": {
- "latitude": 414204288,
- "longitude": -747895140
- },
- "name": ""
-}, {
- "location": {
- "latitude": 414777405,
- "longitude": -740615601
- },
- "name": ""
-}, {
- "location": {
- "latitude": 415464475,
- "longitude": -747175374
- },
- "name": "48 North Road, Forestburgh, NY 12777, USA"
-}, {
- "location": {
- "latitude": 404062378,
- "longitude": -746376177
- },
- "name": ""
-}, {
- "location": {
- "latitude": 405688272,
- "longitude": -749285130
- },
- "name": ""
-}, {
- "location": {
- "latitude": 400342070,
- "longitude": -748788996
- },
- "name": ""
-}, {
- "location": {
- "latitude": 401809022,
- "longitude": -744157964
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404226644,
- "longitude": -740517141
- },
- "name": "9 Thompson Avenue, Leonardo, NJ 07737, USA"
-}, {
- "location": {
- "latitude": 410322033,
- "longitude": -747871659
- },
- "name": ""
-}, {
- "location": {
- "latitude": 407100674,
- "longitude": -747742727
- },
- "name": ""
-}, {
- "location": {
- "latitude": 418811433,
- "longitude": -741718005
- },
- "name": "213 Bush Road, Stone Ridge, NY 12484, USA"
-}, {
- "location": {
- "latitude": 415034302,
- "longitude": -743850945
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411349992,
- "longitude": -743694161
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404839914,
- "longitude": -744759616
- },
- "name": "1-17 Bergen Court, New Brunswick, NJ 08901, USA"
-}, {
- "location": {
- "latitude": 414638017,
- "longitude": -745957854
- },
- "name": "35 Oakland Valley Road, Cuddebackville, NY 12729, USA"
-}, {
- "location": {
- "latitude": 412127800,
- "longitude": -740173578
- },
- "name": ""
-}, {
- "location": {
- "latitude": 401263460,
- "longitude": -747964303
- },
- "name": ""
-}, {
- "location": {
- "latitude": 412843391,
- "longitude": -749086026
- },
- "name": ""
-}, {
- "location": {
- "latitude": 418512773,
- "longitude": -743067823
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404318328,
- "longitude": -740835638
- },
- "name": "42-102 Main Street, Belford, NJ 07718, USA"
-}, {
- "location": {
- "latitude": 419020746,
- "longitude": -741172328
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404080723,
- "longitude": -746119569
- },
- "name": ""
-}, {
- "location": {
- "latitude": 401012643,
- "longitude": -744035134
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404306372,
- "longitude": -741079661
- },
- "name": ""
-}, {
- "location": {
- "latitude": 403966326,
- "longitude": -748519297
- },
- "name": ""
-}, {
- "location": {
- "latitude": 405002031,
- "longitude": -748407866
- },
- "name": ""
-}, {
- "location": {
- "latitude": 409532885,
- "longitude": -742200683
- },
- "name": ""
-}, {
- "location": {
- "latitude": 416851321,
- "longitude": -742674555
- },
- "name": ""
-}, {
- "location": {
- "latitude": 406411633,
- "longitude": -741722051
- },
- "name": "3387 Richmond Terrace, Staten Island, NY 10303, USA"
-}, {
- "location": {
- "latitude": 413069058,
- "longitude": -744597778
- },
- "name": "261 Van Sickle Road, Goshen, NY 10924, USA"
-}, {
- "location": {
- "latitude": 418465462,
- "longitude": -746859398
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411733222,
- "longitude": -744228360
- },
- "name": ""
-}, {
- "location": {
- "latitude": 410248224,
- "longitude": -747127767
- },
- "name": "3 Hasta Way, Newton, NJ 07860, USA"
-}]
diff --git a/cpp/route_guide/route_guide_server.cc b/cpp/route_guide/route_guide_server.cc
deleted file mode 100644
index b375392..0000000
--- a/cpp/route_guide/route_guide_server.cc
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include "helper.h"
-#include "route_guide.grpc.pb.h"
-
-using grpc::Server;
-using grpc::ServerBuilder;
-using grpc::ServerContext;
-using grpc::ServerReader;
-using grpc::ServerReaderWriter;
-using grpc::ServerWriter;
-using grpc::Status;
-using examples::Point;
-using examples::Feature;
-using examples::Rectangle;
-using examples::RouteSummary;
-using examples::RouteNote;
-using examples::RouteGuide;
-using std::chrono::system_clock;
-
-
-float ConvertToRadians(float num) {
- return num * 3.1415926 /180;
-}
-
-float GetDistance(const Point& start, const Point& end) {
- const float kCoordFactor = 10000000.0;
- float lat_1 = start.latitude() / kCoordFactor;
- float lat_2 = end.latitude() / kCoordFactor;
- float lon_1 = start.longitude() / kCoordFactor;
- float lon_2 = end.longitude() / kCoordFactor;
- float lat_rad_1 = ConvertToRadians(lat_1);
- float lat_rad_2 = ConvertToRadians(lat_2);
- float delta_lat_rad = ConvertToRadians(lat_2-lat_1);
- float delta_lon_rad = ConvertToRadians(lon_2-lon_1);
-
- float a = pow(sin(delta_lat_rad/2), 2) + cos(lat_rad_1) * cos(lat_rad_2) *
- pow(sin(delta_lon_rad/2), 2);
- float c = 2 * atan2(sqrt(a), sqrt(1-a));
- int R = 6371000; // metres
-
- return R * c;
-}
-
-std::string GetFeatureName(const Point& point,
- const std::vector& feature_list) {
- for (const Feature& f : feature_list) {
- if (f.location().latitude() == point.latitude() &&
- f.location().longitude() == point.longitude()) {
- return f.name();
- }
- }
- return "";
-}
-
-class RouteGuideImpl final : public RouteGuide::Service {
- public:
- explicit RouteGuideImpl(const std::string& db) {
- examples::ParseDb(db, &feature_list_);
- }
-
- Status GetFeature(ServerContext* context, const Point* point,
- Feature* feature) override {
- feature->set_name(GetFeatureName(*point, feature_list_));
- feature->mutable_location()->CopyFrom(*point);
- return Status::OK;
- }
-
- Status ListFeatures(ServerContext* context,
- const examples::Rectangle* rectangle,
- ServerWriter* writer) override {
- auto lo = rectangle->lo();
- auto hi = rectangle->hi();
- long left = (std::min)(lo.longitude(), hi.longitude());
- long right = (std::max)(lo.longitude(), hi.longitude());
- long top = (std::max)(lo.latitude(), hi.latitude());
- long bottom = (std::min)(lo.latitude(), hi.latitude());
- for (const Feature& f : feature_list_) {
- if (f.location().longitude() >= left &&
- f.location().longitude() <= right &&
- f.location().latitude() >= bottom &&
- f.location().latitude() <= top) {
- writer->Write(f);
- }
- }
- return Status::OK;
- }
-
- Status RecordRoute(ServerContext* context, ServerReader* reader,
- RouteSummary* summary) override {
- Point point;
- int point_count = 0;
- int feature_count = 0;
- float distance = 0.0;
- Point previous;
-
- system_clock::time_point start_time = system_clock::now();
- while (reader->Read(&point)) {
- point_count++;
- if (!GetFeatureName(point, feature_list_).empty()) {
- feature_count++;
- }
- if (point_count != 1) {
- distance += GetDistance(previous, point);
- }
- previous = point;
- }
- system_clock::time_point end_time = system_clock::now();
- summary->set_point_count(point_count);
- summary->set_feature_count(feature_count);
- summary->set_distance(static_cast(distance));
- auto secs = std::chrono::duration_cast(
- end_time - start_time);
- summary->set_elapsed_time(secs.count());
-
- return Status::OK;
- }
-
- Status RouteChat(ServerContext* context,
- ServerReaderWriter* stream) override {
- std::vector received_notes;
- RouteNote note;
- while (stream->Read(¬e)) {
- for (const RouteNote& n : received_notes) {
- if (n.location().latitude() == note.location().latitude() &&
- n.location().longitude() == note.location().longitude()) {
- stream->Write(n);
- }
- }
- received_notes.push_back(note);
- }
-
- return Status::OK;
- }
-
- private:
-
- std::vector feature_list_;
-};
-
-void RunServer(const std::string& db_path) {
- std::string server_address("0.0.0.0:50051");
- RouteGuideImpl service(db_path);
-
- ServerBuilder builder;
- builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
- builder.RegisterService(&service);
- std::unique_ptr server(builder.BuildAndStart());
- std::cout << "Server listening on " << server_address << std::endl;
- server->Wait();
-}
-
-int main(int argc, char** argv) {
- // Expect only arg: --db_path=path/to/route_guide_db.json.
- std::string db = examples::GetDbFileContent(argc, argv);
- RunServer(db);
-
- return 0;
-}
diff --git a/csharp/.gitignore b/csharp/.gitignore
deleted file mode 100644
index 585000e..0000000
--- a/csharp/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin/
-obj/
-packages/
-*.suo
-*.userprefs
diff --git a/csharp/.nuget/packages.config b/csharp/.nuget/packages.config
deleted file mode 100644
index b143730..0000000
--- a/csharp/.nuget/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/csharp/Greeter.sln b/csharp/Greeter.sln
deleted file mode 100644
index 9430e94..0000000
--- a/csharp/Greeter.sln
+++ /dev/null
@@ -1,42 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Greeter", "Greeter\Greeter.csproj", "{724DFC8C-4B57-4C3F-811C-0463BE2A2829}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreeterServer", "GreeterServer\GreeterServer.csproj", "{A7706C84-92D2-4B7A-B779-76B64D2950EC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreeterClient", "GreeterClient\GreeterClient.csproj", "{ACCF4597-3748-4117-8633-1CB767F8CCC3}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{FF1EBE95-F20D-4C27-8A61-D0125F3C8152}"
- ProjectSection(SolutionItems) = preProject
- .nuget\packages.config = .nuget\packages.config
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {724DFC8C-4B57-4C3F-811C-0463BE2A2829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {724DFC8C-4B57-4C3F-811C-0463BE2A2829}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {724DFC8C-4B57-4C3F-811C-0463BE2A2829}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {724DFC8C-4B57-4C3F-811C-0463BE2A2829}.Release|Any CPU.Build.0 = Release|Any CPU
- {A7706C84-92D2-4B7A-B779-76B64D2950EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A7706C84-92D2-4B7A-B779-76B64D2950EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A7706C84-92D2-4B7A-B779-76B64D2950EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A7706C84-92D2-4B7A-B779-76B64D2950EC}.Release|Any CPU.Build.0 = Release|Any CPU
- {ACCF4597-3748-4117-8633-1CB767F8CCC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {ACCF4597-3748-4117-8633-1CB767F8CCC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {ACCF4597-3748-4117-8633-1CB767F8CCC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {ACCF4597-3748-4117-8633-1CB767F8CCC3}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = Greeter\Greeter.csproj
- EndGlobalSection
-EndGlobal
diff --git a/csharp/Greeter/.gitignore b/csharp/Greeter/.gitignore
deleted file mode 100644
index 1746e32..0000000
--- a/csharp/Greeter/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-obj
diff --git a/csharp/Greeter/Greeter.csproj b/csharp/Greeter/Greeter.csproj
deleted file mode 100644
index b8f965d..0000000
--- a/csharp/Greeter/Greeter.csproj
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-
-
- Debug
- AnyCPU
- 10.0.0
- 2.0
- {724DFC8C-4B57-4C3F-811C-0463BE2A2829}
- Library
- Greeter
- Greeter
- v4.5
- 927432a0
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- false
-
-
- full
- true
- bin\Release
- prompt
- 4
- false
-
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.dll
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.Serialization.dll
-
-
- False
- ..\packages\Grpc.Core.0.6.0\lib\net45\Grpc.Core.dll
-
-
-
- False
- ..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
- ..\packages\Ix-Async.1.2.3\lib\net45\System.Interactive.Async.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/Greeter/Helloworld.cs b/csharp/Greeter/Helloworld.cs
deleted file mode 100644
index 923a427..0000000
--- a/csharp/Greeter/Helloworld.cs
+++ /dev/null
@@ -1,617 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: helloworld.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.ProtocolBuffers;
-using pbc = global::Google.ProtocolBuffers.Collections;
-using pbd = global::Google.ProtocolBuffers.Descriptors;
-using scg = global::System.Collections.Generic;
-namespace helloworld {
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Helloworld {
-
- #region Extension registration
- public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
- }
- #endregion
- #region Static variables
- internal static pbd::MessageDescriptor internal__static_helloworld_HelloRequest__Descriptor;
- internal static pb::FieldAccess.FieldAccessorTable internal__static_helloworld_HelloRequest__FieldAccessorTable;
- internal static pbd::MessageDescriptor internal__static_helloworld_HelloReply__Descriptor;
- internal static pb::FieldAccess.FieldAccessorTable internal__static_helloworld_HelloReply__FieldAccessorTable;
- #endregion
- #region Descriptor
- public static pbd::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbd::FileDescriptor descriptor;
-
- static Helloworld() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "ChBoZWxsb3dvcmxkLnByb3RvEgpoZWxsb3dvcmxkIhwKDEhlbGxvUmVxdWVz",
- "dBIMCgRuYW1lGAEgASgJIh0KCkhlbGxvUmVwbHkSDwoHbWVzc2FnZRgBIAEo",
- "CTJJCgdHcmVldGVyEj4KCFNheUhlbGxvEhguaGVsbG93b3JsZC5IZWxsb1Jl",
- "cXVlc3QaFi5oZWxsb3dvcmxkLkhlbGxvUmVwbHkiAEISChBpby5ncnBjLmV4",
- "YW1wbGVz"));
- pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
- descriptor = root;
- internal__static_helloworld_HelloRequest__Descriptor = Descriptor.MessageTypes[0];
- internal__static_helloworld_HelloRequest__FieldAccessorTable =
- new pb::FieldAccess.FieldAccessorTable(internal__static_helloworld_HelloRequest__Descriptor,
- new string[] { "Name", });
- internal__static_helloworld_HelloReply__Descriptor = Descriptor.MessageTypes[1];
- internal__static_helloworld_HelloReply__FieldAccessorTable =
- new pb::FieldAccess.FieldAccessorTable(internal__static_helloworld_HelloReply__Descriptor,
- new string[] { "Message", });
- pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();
- RegisterAllExtensions(registry);
- return registry;
- };
- pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbd::FileDescriptor[] {
- }, assigner);
- }
- #endregion
-
- }
- #region Messages
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class HelloRequest : pb::GeneratedMessage {
- private HelloRequest() { }
- private static readonly HelloRequest defaultInstance = new HelloRequest().MakeReadOnly();
- private static readonly string[] _helloRequestFieldNames = new string[] { "name" };
- private static readonly uint[] _helloRequestFieldTags = new uint[] { 10 };
- public static HelloRequest DefaultInstance {
- get { return defaultInstance; }
- }
-
- public override HelloRequest DefaultInstanceForType {
- get { return DefaultInstance; }
- }
-
- protected override HelloRequest ThisMessage {
- get { return this; }
- }
-
- public static pbd::MessageDescriptor Descriptor {
- get { return global::helloworld.Helloworld.internal__static_helloworld_HelloRequest__Descriptor; }
- }
-
- protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
- get { return global::helloworld.Helloworld.internal__static_helloworld_HelloRequest__FieldAccessorTable; }
- }
-
- public const int NameFieldNumber = 1;
- private bool hasName;
- private string name_ = "";
- public bool HasName {
- get { return hasName; }
- }
- public string Name {
- get { return name_; }
- }
-
- public override bool IsInitialized {
- get {
- return true;
- }
- }
-
- public override void WriteTo(pb::ICodedOutputStream output) {
- CalcSerializedSize();
- string[] field_names = _helloRequestFieldNames;
- if (hasName) {
- output.WriteString(1, field_names[0], Name);
- }
- UnknownFields.WriteTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public override int SerializedSize {
- get {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
- return CalcSerializedSize();
- }
- }
-
- private int CalcSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasName) {
- size += pb::CodedOutputStream.ComputeStringSize(1, Name);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
- }
- public static HelloRequest ParseFrom(pb::ByteString data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static HelloRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static HelloRequest ParseFrom(byte[] data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static HelloRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static HelloRequest ParseFrom(global::System.IO.Stream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static HelloRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- public static HelloRequest ParseDelimitedFrom(global::System.IO.Stream input) {
- return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
- }
- public static HelloRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
- }
- public static HelloRequest ParseFrom(pb::ICodedInputStream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static HelloRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- private HelloRequest MakeReadOnly() {
- return this;
- }
-
- public static Builder CreateBuilder() { return new Builder(); }
- public override Builder ToBuilder() { return CreateBuilder(this); }
- public override Builder CreateBuilderForType() { return new Builder(); }
- public static Builder CreateBuilder(HelloRequest prototype) {
- return new Builder(prototype);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Builder : pb::GeneratedBuilder {
- protected override Builder ThisBuilder {
- get { return this; }
- }
- public Builder() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- }
- internal Builder(HelloRequest cloneFrom) {
- result = cloneFrom;
- resultIsReadOnly = true;
- }
-
- private bool resultIsReadOnly;
- private HelloRequest result;
-
- private HelloRequest PrepareBuilder() {
- if (resultIsReadOnly) {
- HelloRequest original = result;
- result = new HelloRequest();
- resultIsReadOnly = false;
- MergeFrom(original);
- }
- return result;
- }
-
- public override bool IsInitialized {
- get { return result.IsInitialized; }
- }
-
- protected override HelloRequest MessageBeingBuilt {
- get { return PrepareBuilder(); }
- }
-
- public override Builder Clear() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- return this;
- }
-
- public override Builder Clone() {
- if (resultIsReadOnly) {
- return new Builder(result);
- } else {
- return new Builder().MergeFrom(result);
- }
- }
-
- public override pbd::MessageDescriptor DescriptorForType {
- get { return global::helloworld.HelloRequest.Descriptor; }
- }
-
- public override HelloRequest DefaultInstanceForType {
- get { return global::helloworld.HelloRequest.DefaultInstance; }
- }
-
- public override HelloRequest BuildPartial() {
- if (resultIsReadOnly) {
- return result;
- }
- resultIsReadOnly = true;
- return result.MakeReadOnly();
- }
-
- public override Builder MergeFrom(pb::IMessage other) {
- if (other is HelloRequest) {
- return MergeFrom((HelloRequest) other);
- } else {
- base.MergeFrom(other);
- return this;
- }
- }
-
- public override Builder MergeFrom(HelloRequest other) {
- if (other == global::helloworld.HelloRequest.DefaultInstance) return this;
- PrepareBuilder();
- if (other.HasName) {
- Name = other.Name;
- }
- this.MergeUnknownFields(other.UnknownFields);
- return this;
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input) {
- return MergeFrom(input, pb::ExtensionRegistry.Empty);
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- PrepareBuilder();
- pb::UnknownFieldSet.Builder unknownFields = null;
- uint tag;
- string field_name;
- while (input.ReadTag(out tag, out field_name)) {
- if(tag == 0 && field_name != null) {
- int field_ordinal = global::System.Array.BinarySearch(_helloRequestFieldNames, field_name, global::System.StringComparer.Ordinal);
- if(field_ordinal >= 0)
- tag = _helloRequestFieldTags[field_ordinal];
- else {
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- continue;
- }
- }
- switch (tag) {
- case 0: {
- throw pb::InvalidProtocolBufferException.InvalidTag();
- }
- default: {
- if (pb::WireFormat.IsEndGroupTag(tag)) {
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- break;
- }
- case 10: {
- result.hasName = input.ReadString(ref result.name_);
- break;
- }
- }
- }
-
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
-
-
- public bool HasName {
- get { return result.hasName; }
- }
- public string Name {
- get { return result.Name; }
- set { SetName(value); }
- }
- public Builder SetName(string value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasName = true;
- result.name_ = value;
- return this;
- }
- public Builder ClearName() {
- PrepareBuilder();
- result.hasName = false;
- result.name_ = "";
- return this;
- }
- }
- static HelloRequest() {
- object.ReferenceEquals(global::helloworld.Helloworld.Descriptor, null);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class HelloReply : pb::GeneratedMessage {
- private HelloReply() { }
- private static readonly HelloReply defaultInstance = new HelloReply().MakeReadOnly();
- private static readonly string[] _helloReplyFieldNames = new string[] { "message" };
- private static readonly uint[] _helloReplyFieldTags = new uint[] { 10 };
- public static HelloReply DefaultInstance {
- get { return defaultInstance; }
- }
-
- public override HelloReply DefaultInstanceForType {
- get { return DefaultInstance; }
- }
-
- protected override HelloReply ThisMessage {
- get { return this; }
- }
-
- public static pbd::MessageDescriptor Descriptor {
- get { return global::helloworld.Helloworld.internal__static_helloworld_HelloReply__Descriptor; }
- }
-
- protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
- get { return global::helloworld.Helloworld.internal__static_helloworld_HelloReply__FieldAccessorTable; }
- }
-
- public const int MessageFieldNumber = 1;
- private bool hasMessage;
- private string message_ = "";
- public bool HasMessage {
- get { return hasMessage; }
- }
- public string Message {
- get { return message_; }
- }
-
- public override bool IsInitialized {
- get {
- return true;
- }
- }
-
- public override void WriteTo(pb::ICodedOutputStream output) {
- CalcSerializedSize();
- string[] field_names = _helloReplyFieldNames;
- if (hasMessage) {
- output.WriteString(1, field_names[0], Message);
- }
- UnknownFields.WriteTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public override int SerializedSize {
- get {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
- return CalcSerializedSize();
- }
- }
-
- private int CalcSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasMessage) {
- size += pb::CodedOutputStream.ComputeStringSize(1, Message);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
- }
- public static HelloReply ParseFrom(pb::ByteString data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static HelloReply ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static HelloReply ParseFrom(byte[] data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static HelloReply ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static HelloReply ParseFrom(global::System.IO.Stream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static HelloReply ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- public static HelloReply ParseDelimitedFrom(global::System.IO.Stream input) {
- return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
- }
- public static HelloReply ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
- }
- public static HelloReply ParseFrom(pb::ICodedInputStream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static HelloReply ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- private HelloReply MakeReadOnly() {
- return this;
- }
-
- public static Builder CreateBuilder() { return new Builder(); }
- public override Builder ToBuilder() { return CreateBuilder(this); }
- public override Builder CreateBuilderForType() { return new Builder(); }
- public static Builder CreateBuilder(HelloReply prototype) {
- return new Builder(prototype);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Builder : pb::GeneratedBuilder {
- protected override Builder ThisBuilder {
- get { return this; }
- }
- public Builder() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- }
- internal Builder(HelloReply cloneFrom) {
- result = cloneFrom;
- resultIsReadOnly = true;
- }
-
- private bool resultIsReadOnly;
- private HelloReply result;
-
- private HelloReply PrepareBuilder() {
- if (resultIsReadOnly) {
- HelloReply original = result;
- result = new HelloReply();
- resultIsReadOnly = false;
- MergeFrom(original);
- }
- return result;
- }
-
- public override bool IsInitialized {
- get { return result.IsInitialized; }
- }
-
- protected override HelloReply MessageBeingBuilt {
- get { return PrepareBuilder(); }
- }
-
- public override Builder Clear() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- return this;
- }
-
- public override Builder Clone() {
- if (resultIsReadOnly) {
- return new Builder(result);
- } else {
- return new Builder().MergeFrom(result);
- }
- }
-
- public override pbd::MessageDescriptor DescriptorForType {
- get { return global::helloworld.HelloReply.Descriptor; }
- }
-
- public override HelloReply DefaultInstanceForType {
- get { return global::helloworld.HelloReply.DefaultInstance; }
- }
-
- public override HelloReply BuildPartial() {
- if (resultIsReadOnly) {
- return result;
- }
- resultIsReadOnly = true;
- return result.MakeReadOnly();
- }
-
- public override Builder MergeFrom(pb::IMessage other) {
- if (other is HelloReply) {
- return MergeFrom((HelloReply) other);
- } else {
- base.MergeFrom(other);
- return this;
- }
- }
-
- public override Builder MergeFrom(HelloReply other) {
- if (other == global::helloworld.HelloReply.DefaultInstance) return this;
- PrepareBuilder();
- if (other.HasMessage) {
- Message = other.Message;
- }
- this.MergeUnknownFields(other.UnknownFields);
- return this;
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input) {
- return MergeFrom(input, pb::ExtensionRegistry.Empty);
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- PrepareBuilder();
- pb::UnknownFieldSet.Builder unknownFields = null;
- uint tag;
- string field_name;
- while (input.ReadTag(out tag, out field_name)) {
- if(tag == 0 && field_name != null) {
- int field_ordinal = global::System.Array.BinarySearch(_helloReplyFieldNames, field_name, global::System.StringComparer.Ordinal);
- if(field_ordinal >= 0)
- tag = _helloReplyFieldTags[field_ordinal];
- else {
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- continue;
- }
- }
- switch (tag) {
- case 0: {
- throw pb::InvalidProtocolBufferException.InvalidTag();
- }
- default: {
- if (pb::WireFormat.IsEndGroupTag(tag)) {
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- break;
- }
- case 10: {
- result.hasMessage = input.ReadString(ref result.message_);
- break;
- }
- }
- }
-
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
-
-
- public bool HasMessage {
- get { return result.hasMessage; }
- }
- public string Message {
- get { return result.Message; }
- set { SetMessage(value); }
- }
- public Builder SetMessage(string value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasMessage = true;
- result.message_ = value;
- return this;
- }
- public Builder ClearMessage() {
- PrepareBuilder();
- result.hasMessage = false;
- result.message_ = "";
- return this;
- }
- }
- static HelloReply() {
- object.ReferenceEquals(global::helloworld.Helloworld.Descriptor, null);
- }
- }
-
- #endregion
-
-}
-
-#endregion Designer generated code
diff --git a/csharp/Greeter/HelloworldGrpc.cs b/csharp/Greeter/HelloworldGrpc.cs
deleted file mode 100644
index 1ca9d28..0000000
--- a/csharp/Greeter/HelloworldGrpc.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: helloworld.proto
-#region Designer generated code
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Grpc.Core;
-
-namespace helloworld {
- public static class Greeter
- {
- static readonly string __ServiceName = "helloworld.Greeter";
-
- static readonly Marshaller __Marshaller_HelloRequest = Marshallers.Create((arg) => arg.ToByteArray(), global::helloworld.HelloRequest.ParseFrom);
- static readonly Marshaller __Marshaller_HelloReply = Marshallers.Create((arg) => arg.ToByteArray(), global::helloworld.HelloReply.ParseFrom);
-
- static readonly Method __Method_SayHello = new Method(
- MethodType.Unary,
- "SayHello",
- __Marshaller_HelloRequest,
- __Marshaller_HelloReply);
-
- // client-side stub interface
- public interface IGreeterClient
- {
- global::helloworld.HelloReply SayHello(global::helloworld.HelloRequest request, CancellationToken token = default(CancellationToken));
- Task SayHelloAsync(global::helloworld.HelloRequest request, CancellationToken token = default(CancellationToken));
- }
-
- // server-side interface
- public interface IGreeter
- {
- Task SayHello(ServerCallContext context, global::helloworld.HelloRequest request);
- }
-
- // client stub
- public class GreeterClient : AbstractStub, IGreeterClient
- {
- public GreeterClient(Channel channel) : this(channel, StubConfiguration.Default)
- {
- }
- public GreeterClient(Channel channel, StubConfiguration config) : base(channel, config)
- {
- }
- public global::helloworld.HelloReply SayHello(global::helloworld.HelloRequest request, CancellationToken token = default(CancellationToken))
- {
- var call = CreateCall(__ServiceName, __Method_SayHello);
- return Calls.BlockingUnaryCall(call, request, token);
- }
- public Task SayHelloAsync(global::helloworld.HelloRequest request, CancellationToken token = default(CancellationToken))
- {
- var call = CreateCall(__ServiceName, __Method_SayHello);
- return Calls.AsyncUnaryCall(call, request, token);
- }
- }
-
- // creates service definition that can be registered with a server
- public static ServerServiceDefinition BindService(IGreeter serviceImpl)
- {
- return ServerServiceDefinition.CreateBuilder(__ServiceName)
- .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build();
- }
-
- // creates a new client stub
- public static IGreeterClient NewStub(Channel channel)
- {
- return new GreeterClient(channel);
- }
-
- // creates a new client stub
- public static IGreeterClient NewStub(Channel channel, StubConfiguration config)
- {
- return new GreeterClient(channel, config);
- }
- }
-}
-#endregion
diff --git a/csharp/Greeter/Properties/AssemblyInfo.cs b/csharp/Greeter/Properties/AssemblyInfo.cs
deleted file mode 100644
index b9d0dc2..0000000
--- a/csharp/Greeter/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-[assembly: AssemblyTitle("Greeter")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("jtattermusch")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("1.0.*")]
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
diff --git a/csharp/Greeter/packages.config b/csharp/Greeter/packages.config
deleted file mode 100644
index 5922553..0000000
--- a/csharp/Greeter/packages.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/Greeter/protos/helloworld.proto b/csharp/Greeter/protos/helloworld.proto
deleted file mode 100644
index e02ebd9..0000000
--- a/csharp/Greeter/protos/helloworld.proto
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// TODO(jtattermusch): as of now, C# protobufs don't officially support
-// proto3.
-syntax = "proto2";
-
-option java_package = "io.grpc.examples";
-
-package helloworld;
-
-// The greeting service definition.
-service Greeter {
- // Sends a greeting
- rpc SayHello (HelloRequest) returns (HelloReply) {}
-}
-
-// The request message containing the user's name.
-message HelloRequest {
- optional string name = 1;
-}
-
-// The response message containing the greetings
-message HelloReply {
- optional string message = 1;
-}
diff --git a/csharp/GreeterClient/.gitignore b/csharp/GreeterClient/.gitignore
deleted file mode 100644
index 1746e32..0000000
--- a/csharp/GreeterClient/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-obj
diff --git a/csharp/GreeterClient/GreeterClient.csproj b/csharp/GreeterClient/GreeterClient.csproj
deleted file mode 100644
index 59b768a..0000000
--- a/csharp/GreeterClient/GreeterClient.csproj
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
- Debug
- AnyCPU
- 10.0.0
- 2.0
- {ACCF4597-3748-4117-8633-1CB767F8CCC3}
- Exe
- GreeterClient
- GreeterClient
- v4.5
- 985ca8be
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- true
-
-
- full
- true
- bin\Release
- prompt
- 4
- true
-
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.dll
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.Serialization.dll
-
-
- False
- ..\packages\Grpc.Core.0.6.0\lib\net45\Grpc.Core.dll
-
-
-
- False
- ..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
- ..\packages\Ix-Async.1.2.3\lib\net45\System.Interactive.Async.dll
-
-
-
-
-
-
-
-
-
- {724DFC8C-4B57-4C3F-811C-0463BE2A2829}
- Greeter
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/GreeterClient/Program.cs b/csharp/GreeterClient/Program.cs
deleted file mode 100644
index 61c2976..0000000
--- a/csharp/GreeterClient/Program.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using Grpc.Core;
-using helloworld;
-
-namespace GreeterClient
-{
- class ClientMainClass
- {
- public static void Main(string[] args)
- {
- GrpcEnvironment.Initialize();
-
- using (Channel channel = new Channel("127.0.0.1:50051"))
- {
- var client = Greeter.NewStub(channel);
- String user = "you";
-
- var reply = client.SayHello(new HelloRequest.Builder { Name = user }.Build());
- Console.WriteLine("Greeting: " + reply.Message);
- }
-
- GrpcEnvironment.Shutdown();
- }
- }
-}
diff --git a/csharp/GreeterClient/Properties/AssemblyInfo.cs b/csharp/GreeterClient/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1422e95..0000000
--- a/csharp/GreeterClient/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-[assembly: AssemblyTitle("GreeterClient")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("jtattermusch")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("1.0.*")]
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
diff --git a/csharp/GreeterClient/packages.config b/csharp/GreeterClient/packages.config
deleted file mode 100644
index 5922553..0000000
--- a/csharp/GreeterClient/packages.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/GreeterServer/.gitignore b/csharp/GreeterServer/.gitignore
deleted file mode 100644
index 1746e32..0000000
--- a/csharp/GreeterServer/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-obj
diff --git a/csharp/GreeterServer/GreeterServer.csproj b/csharp/GreeterServer/GreeterServer.csproj
deleted file mode 100644
index cd50d6c..0000000
--- a/csharp/GreeterServer/GreeterServer.csproj
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
- Debug
- AnyCPU
- 10.0.0
- 2.0
- {A7706C84-92D2-4B7A-B779-76B64D2950EC}
- Exe
- GreeterServer
- GreeterServer
- v4.5
- a1eeb1d8
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- true
-
-
- full
- true
- bin\Release
- prompt
- 4
- true
-
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.dll
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.Serialization.dll
-
-
- False
- ..\packages\Grpc.Core.0.6.0\lib\net45\Grpc.Core.dll
-
-
-
- False
- ..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
- ..\packages\Ix-Async.1.2.3\lib\net45\System.Interactive.Async.dll
-
-
-
-
-
-
-
-
-
- {724DFC8C-4B57-4C3F-811C-0463BE2A2829}
- Greeter
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/GreeterServer/Program.cs b/csharp/GreeterServer/Program.cs
deleted file mode 100644
index 9482797..0000000
--- a/csharp/GreeterServer/Program.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using Grpc.Core;
-using helloworld;
-
-namespace GreeterServer
-{
- class GreeterImpl : Greeter.IGreeter
- {
- // Server side handler of the SayHello RPC
- public Task SayHello(ServerCallContext context, HelloRequest request)
- {
- var reply = new HelloReply.Builder { Message = "Hello " + request.Name }.Build();
- return Task.FromResult(reply);
- }
- }
-
- class ServerMainClass
- {
- public static void Main(string[] args)
- {
- GrpcEnvironment.Initialize();
-
- Server server = new Server();
- server.AddServiceDefinition(Greeter.BindService(new GreeterImpl()));
- int port = server.AddListeningPort("localhost", 50051);
- server.Start();
-
- Console.WriteLine("Greeter server listening on port " + port);
- Console.WriteLine("Press any key to stop the server...");
- Console.ReadKey();
-
- server.ShutdownAsync().Wait();
- GrpcEnvironment.Shutdown();
- }
- }
-}
diff --git a/csharp/GreeterServer/Properties/AssemblyInfo.cs b/csharp/GreeterServer/Properties/AssemblyInfo.cs
deleted file mode 100644
index f8a8d52..0000000
--- a/csharp/GreeterServer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-[assembly: AssemblyTitle("GreeterServer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("jtattermusch")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("1.0.*")]
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
diff --git a/csharp/GreeterServer/packages.config b/csharp/GreeterServer/packages.config
deleted file mode 100644
index 5922553..0000000
--- a/csharp/GreeterServer/packages.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/README.md b/csharp/README.md
deleted file mode 100644
index 77d1aaf..0000000
--- a/csharp/README.md
+++ /dev/null
@@ -1,72 +0,0 @@
-gRPC in 3 minutes (C#)
-========================
-
-BACKGROUND
--------------
-For this sample, we've already generated the server and client stubs from `helloworld.proto`.
-Example projects depend on NuGet packages `Grpc` and `Google.ProtocolBuffers` which have been already added to the project for you.
-
-PREREQUISITES
--------------
-**Windows**
-- .NET 4.5+
-- VS 2013 (with NuGet plugin installed)
-
-**Linux (Mono)**
-- Mono
-- Monodevelop 5.9 with NuGet Add-in installed (older versions might work)
-
-**MacOS (Mono)**
-- Xamarin Studio (with NuGet plugin installed)
-
-BUILD
--------
-
-**Windows**
-- Clone this repository.
-
-- Open solution `Greeter.sln` with Visual Studio
-
-- Build the solution (this will automatically download NuGet dependencies)
-
-**Linux (Mono)**
-- Clone this repository.
-
-- Install gRPC C Core using instructions in https://github.com/grpc/homebrew-grpc
-
-- gRPC C# depends on native shared library `libgrpc_csharp_ext.so`. To make it visible
- to Mono runtime, follow instructions in [Using gRPC C# on Linux](https://github.com/grpc/grpc/tree/master/src/csharp#usage-linux-mono)
-
-- Open solution `Greeter.sln` in MonoDevelop (you need to manually restore dependencies by using `mono nuget.exe restore` if you don't have NuGet add-in)
-
-- Build the solution.
-
-**MacOS (Mono)**
-- See [Using gRPC C# on MacOS](https://github.com/grpc/grpc/tree/master/src/csharp#usage-macos-mono) for more info
- on MacOS support.
-
-Try it!
--------
-
-- Run the server
-
- ```
- > cd GreeterServer/bin/Debug
- > GreeterServer.exe
- ```
-
-- Run the client
-
- ```
- > cd GreeterClient/bin/Debug
- > GreeterClient.exe
- ```
-
-You can also run the server and client directly from Visual Studio.
-
-On Linux or Mac, use `mono GreeterServer.exe` and `mono GreeterClient.exe` to run the server and client.
-
-Tutorial
---------
-
-You can find a more detailed tutorial in [gRPC Basics: C#](https://github.com/grpc/grpc-common/blob/master/csharp/route_guide/README.md)
diff --git a/csharp/route_guide/.gitignore b/csharp/route_guide/.gitignore
deleted file mode 100644
index 585000e..0000000
--- a/csharp/route_guide/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin/
-obj/
-packages/
-*.suo
-*.userprefs
diff --git a/csharp/route_guide/.nuget/packages.config b/csharp/route_guide/.nuget/packages.config
deleted file mode 100644
index b143730..0000000
--- a/csharp/route_guide/.nuget/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/README.md b/csharp/route_guide/README.md
deleted file mode 100644
index 35c6024..0000000
--- a/csharp/route_guide/README.md
+++ /dev/null
@@ -1,409 +0,0 @@
-#gRPC Basics: C# #
-
-This tutorial provides a basic C# programmer's introduction to working with gRPC. By walking through this example you'll learn how to:
-
-- Define a service in a .proto file.
-- Generate server and client code using the protocol buffer compiler.
-- Use the C# gRPC API to write a simple client and server for your service.
-
-It assumes that you have read the [Getting started](https://github.com/grpc/grpc-common) guide and are familiar with [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). Note that the example in this tutorial only uses the proto2 version of the protocol buffers language, as proto3 support for C# is not ready yet (see [protobuf C# README](https://github.com/google/protobuf/tree/master/csharp#proto2--proto3)).
-
-This isn't a comprehensive guide to using gRPC in C#: more reference documentation is coming soon.
-
-## Why use gRPC?
-
-Our example is a simple route mapping application that lets clients get information about features on their route, create a summary of their route, and exchange route information such as traffic updates with the server and other clients.
-
-With gRPC we can define our service once in a .proto file and implement clients and servers in any of gRPC's supported languages, which in turn can be run in environments ranging from servers inside Google to your own tablet - all the complexity of communication between different languages and environments is handled for you by gRPC. We also get all the advantages of working with protocol buffers, including efficient serialization, a simple IDL, and easy interface updating.
-
-## Example code and setup
-
-The example code for our tutorial is in [grpc/grpc-common/csharp/route_guide](https://github.com/grpc/grpc-common/tree/master/csharp/route_guide). To download the example, clone the `grpc-common` repository by running the following command:
-```shell
-$ git clone https://github.com/google/grpc-common.git
-```
-
-All the files for this tutorial are in the directory `grpc-common/csharp/route_guide`.
-Open the solution `grpc-common/csharp/route_guide/RouteGuide.sln` from Visual Studio (or Monodevelop on Linux).
-
-On Windows, you should not need to do anything besides opening the solution. All the needed dependencies will be restored
-for you automatically by the `Grpc` NuGet package upon building the solution.
-
-On Linux (or MacOS), you will first need to install protobuf and gRPC C Core using Linuxbrew (or Homebrew) tool in order to be
-able to generate the server and client interface code and run the examples. Follow the instructions for [Linux](https://github.com/grpc/grpc/tree/master/src/csharp#usage-linux-mono) or [MacOS](https://github.com/grpc/grpc/tree/master/src/csharp#usage-macos-mono).
-
-## Defining the service
-
-Our first step (as you'll know from [Getting started](https://github.com/grpc/grpc-common)) is to define the gRPC *service* and the method *request* and *response* types using [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). You can see the complete .proto file in [`grpc-common/csharp/route_guide/RouteGuide/protos/route_guide.proto`](https://github.com/grpc/grpc-common/blob/master/sharp/route_guide/RouteGuide/protos/route_guide.proto).
-
-To define a service, you specify a named `service` in your .proto file:
-
-```protobuf
-service RouteGuide {
- ...
-}
-```
-
-Then you define `rpc` methods inside your service definition, specifying their request and response types. gRPC lets you define four kinds of service method, all of which are used in the `RouteGuide` service:
-
-- A *simple RPC* where the client sends a request to the server using the stub and waits for a response to come back, just like a normal function call.
-```protobuf
- // Obtains the feature at a given position.
- rpc GetFeature(Point) returns (Feature) {}
-```
-
-- A *server-side streaming RPC* where the client sends a request to the server and gets a stream to read a sequence of messages back. The client reads from the returned stream until there are no more messages. As you can see in our example, you specify a server-side streaming method by placing the `stream` keyword before the *response* type.
-```protobuf
- // Obtains the Features available within the given Rectangle. Results are
- // streamed rather than returned at once (e.g. in a response message with a
- // repeated field), as the rectangle may cover a large area and contain a
- // huge number of features.
- rpc ListFeatures(Rectangle) returns (stream Feature) {}
-```
-
-- A *client-side streaming RPC* where the client writes a sequence of messages and sends them to the server, again using a provided stream. Once the client has finished writing the messages, it waits for the server to read them all and return its response. You specify a server-side streaming method by placing the `stream` keyword before the *request* type.
-```protobuf
- // Accepts a stream of Points on a route being traversed, returning a
- // RouteSummary when traversal is completed.
- rpc RecordRoute(stream Point) returns (RouteSummary) {}
-```
-
-- A *bidirectional streaming RPC* where both sides send a sequence of messages using a read-write stream. The two streams operate independently, so clients and servers can read and write in whatever order they like: for example, the server could wait to receive all the client messages before writing its responses, or it could alternately read a message then write a message, or some other combination of reads and writes. The order of messages in each stream is preserved. You specify this type of method by placing the `stream` keyword before both the request and the response.
-```protobuf
- // Accepts a stream of RouteNotes sent while a route is being traversed,
- // while receiving other RouteNotes (e.g. from other users).
- rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
-```
-
-Our .proto file also contains protocol buffer message type definitions for all the request and response types used in our service methods - for example, here's the `Point` message type:
-```protobuf
-// Points are represented as latitude-longitude pairs in the E7 representation
-// (degrees multiplied by 10**7 and rounded to the nearest integer).
-// Latitudes should be in the range +/- 90 degrees and longitude should be in
-// the range +/- 180 degrees (inclusive).
-message Point {
- int32 latitude = 1;
- int32 longitude = 2;
-}
-```
-
-
-## Generating client and server code
-
-Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler `protoc` with a special gRPC C# plugin.
-
-If you want to run this yourself, make sure you've installed protoc and gRPC C# plugin. The instructions vary based on your OS:
-- For Windows, the `Grpc.Tools` NuGet package contains the binaries you will need to generate the code.
-- For Linux, make sure you've [installed gRPC C Core using Linuxbrew](https://github.com/grpc/grpc/tree/master/src/csharp#usage-linux-mono)
-- For MacOS, make sure you've [installed gRPC C Core using Homebrew](https://github.com/grpc/grpc/tree/master/src/csharp#usage-macos-mono)
-
-Once that's done, the following command can be used to generate the C# code.
-
-To generate the code on Windows, we use `protoc.exe` and `grpc_csharp_plugin.exe` binaries that are shipped with the `Grpc.Tools` NuGet package under the `tools` directory.
-Normally you would need to add the `Grpc.Tools` package to the solution yourself, but in this tutorial it has been already done for you. Following command should be run from the `csharp/route_guide` directory:
-```
-> packages\Grpc.Tools.0.5.1\tools\protoc -I RouteGuide/protos --csharp_out=RouteGuide --grpc_out=RouteGuide --plugin=protoc-gen-grpc=packages\Grpc.Tools.0.5.1\tools\grpc_csharp_plugin.exe RouteGuide/protos/route_guide.proto
-```
-
-On Linux/MacOS, we rely on `protoc` and `grpc_csharp_plugin` being installed by Linuxbrew/Homebrew. Run this command from the route_guide directory:
-```shell
-$ protoc -I RouteGuide/protos --csharp_out=RouteGuide --grpc_out=RouteGuide --plugin=protoc-gen-grpc=`which grpc_csharp_plugin` RouteGuide/protos/route_guide.proto
-```
-
-Running one of the previous commands regenerates the following files in the RouteGuide directory:
-- `RouteGuide/RouteGuide.cs` defines a namespace `examples`
- - This contains all the protocol buffer code to populate, serialize, and retrieve our request and response message types
-- `RouteGuide/RouteGuideGrpc.cs`, provides stub and service classes
- - an interface `RouteGuide.IRouteGuide` to inherit from when defining RouteGuide service implementations
- - a class `RouteGuide.RouteGuideClient` that can be used to access remote RouteGuide instances
-
-
-
-## Creating the server
-
-First let's look at how we create a `RouteGuide` server. If you're only interested in creating gRPC clients, you can skip this section and go straight to [Creating the client](#client) (though you might find it interesting anyway!).
-
-There are two parts to making our `RouteGuide` service do its job:
-- Implementing the service interface generated from our service definition: doing the actual "work" of our service.
-- Running a gRPC server to listen for requests from clients and return the service responses.
-
-You can find our example `RouteGuide` server in [grpc-common/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs](https://github.com/grpc/grpc-common/blob/master/csharp/route_guide/RouteGuideServer/RouteGuideServerImpl.cs). Let's take a closer look at how it works.
-
-### Implementing RouteGuide
-
-As you can see, our server has a `RouteGuideImpl` class that implements the generated `RouteGuide.IRouteGuide`:
-
-```csharp
-// RouteGuideImpl provides an implementation of the RouteGuide service.
-public class RouteGuideImpl : RouteGuide.IRouteGuide
-```
-
-#### Simple RPC
-
-`RouteGuideImpl` implements all our service methods. Let's look at the simplest type first, `GetFeature`, which just gets a `Point` from the client and returns the corresponding feature information from its database in a `Feature`.
-
-```csharp
- public Task GetFeature(Grpc.Core.ServerCallContext context, Point request)
- {
- return Task.FromResult(CheckFeature(request));
- }
-```
-
-The method is passed a context for the RPC (which is empty in the alpha release), the client's `Point` protocol buffer request, and returns a `Feature` protocol buffer. In the method we create the `Feature` with the appropriate information, and then return it. To allow asynchronous
-implementation, the method returns `Task` rather than just `Feature`. You are free to perform your computations synchronously and return
-the result once you've finished, just as we do in the example.
-
-#### Server-side streaming RPC
-
-Now let's look at something a bit more complicated - a streaming RPC. `ListFeatures` is a server-side streaming RPC, so we need to send back multiple `Feature` protocol buffers to our client.
-
-```csharp
- // in RouteGuideImpl
- public async Task ListFeatures(Grpc.Core.ServerCallContext context, Rectangle request,
- Grpc.Core.IServerStreamWriter responseStream)
- {
- int left = Math.Min(request.Lo.Longitude, request.Hi.Longitude);
- int right = Math.Max(request.Lo.Longitude, request.Hi.Longitude);
- int top = Math.Max(request.Lo.Latitude, request.Hi.Latitude);
- int bottom = Math.Min(request.Lo.Latitude, request.Hi.Latitude);
-
- foreach (var feature in features)
- {
- if (!RouteGuideUtil.Exists(feature))
- {
- continue;
- }
-
- int lat = feature.Location.Latitude;
- int lon = feature.Location.Longitude;
- if (lon >= left && lon <= right && lat >= bottom && lat <= top)
- {
- await responseStream.WriteAsync(feature);
- }
- }
- }
-```
-
-As you can see, here the request object is a `Rectangle` in which our client wants to find `Feature`s, but instead of returning a simple response we need to write responses to an asynchronous stream `IServerStreamWriter` using async method `WriteAsync`.
-
-#### Client-side streaming RPC
-
-Similarly, the client-side streaming method `RecordRoute` uses an [IAsyncEnumerator](https://github.com/Reactive-Extensions/Rx.NET/blob/master/Ix.NET/Source/System.Interactive.Async/IAsyncEnumerator.cs), to read the stream of requests using the async method `MoveNext` and the `Current` property.
-
-```csharp
- public async Task RecordRoute(Grpc.Core.ServerCallContext context,
- Grpc.Core.IAsyncStreamReader requestStream)
- {
- int pointCount = 0;
- int featureCount = 0;
- int distance = 0;
- Point previous = null;
- var stopwatch = new Stopwatch();
- stopwatch.Start();
-
- while (await requestStream.MoveNext())
- {
- var point = requestStream.Current;
- pointCount++;
- if (RouteGuideUtil.Exists(CheckFeature(point)))
- {
- featureCount++;
- }
- if (previous != null)
- {
- distance += (int) CalcDistance(previous, point);
- }
- previous = point;
- }
-
- stopwatch.Stop();
- return RouteSummary.CreateBuilder().SetPointCount(pointCount)
- .SetFeatureCount(featureCount).SetDistance(distance)
- .SetElapsedTime((int) (stopwatch.ElapsedMilliseconds / 1000)).Build();
- }
-```
-
-#### Bidirectional streaming RPC
-
-Finally, let's look at our bidirectional streaming RPC `RouteChat`.
-
-```csharp
- public async Task RouteChat(Grpc.Core.ServerCallContext context,
- Grpc.Core.IAsyncStreamReader requestStream, Grpc.Core.IServerStreamWriter responseStream)
- {
- while (await requestStream.MoveNext())
- {
- var note = requestStream.Current;
- List notes = GetOrCreateNotes(note.Location);
-
- List prevNotes;
- lock (notes)
- {
- prevNotes = new List(notes);
- }
-
- foreach (var prevNote in prevNotes)
- {
- await responseStream.WriteAsync(prevNote);
- }
-
- lock (notes)
- {
- notes.Add(note);
- }
- }
- }
-```
-
-Here the method receives both `requestStream` and `responseStream` arguments. Reading the requests is done the same way as in the client-side streaming method `RecordRoute`. Writing the responses is done the same way as in the server-side streaming method `ListFeatures`.
-
-### Starting the server
-
-Once we've implemented all our methods, we also need to start up a gRPC server so that clients can actually use our service. The following snippet shows how we do this for our `RouteGuide` service:
-
-```csharp
-var features = RouteGuideUtil.ParseFeatures(RouteGuideUtil.DefaultFeaturesFile);
-GrpcEnvironment.Initialize();
-
-Server server = new Server();
-server.AddServiceDefinition(RouteGuide.BindService(new RouteGuideImpl(features)));
-int port = server.AddListeningPort("localhost", 50052);
-server.Start();
-
-Console.WriteLine("RouteGuide server listening on port " + port);
-Console.WriteLine("Press any key to stop the server...");
-Console.ReadKey();
-
-server.ShutdownAsync().Wait();
-GrpcEnvironment.Shutdown();
-```
-As you can see, we build and start our server using `Grpc.Core.Server` class. To do this, we:
-
-1. Create an instance of `Grpc.Core.Server`.
-1. Create an instance of our service implementation class `RouteGuideImpl`.
-3. Register our service implementation with the server using the `AddServiceDefinition` method and the generated method `RouteGuide.BindService`.
-2. Specify the address and port we want to use to listen for client requests using the `AddListeningPort` method.
-4. Call `Start` on the server instance to start an RPC server for our service.
-
-
-## Creating the client
-
-In this section, we'll look at creating a C# client for our `RouteGuide` service. You can see our complete example client code in [grpc-common/csharp/route_guide/RouteGuideClient/Program.cs](https://github.com/grpc/grpc-common/blob/master/csharp/route_guide/RouteGuideClient/Program.cs).
-
-### Creating a stub
-
-To call service methods, we first need to create a *stub*.
-
-First, we need to create a gRPC client channel that will connect to gRPC server. Then, we use the `RouteGuide.NewStub` method of the `RouteGuide` class generated from our .proto.
-
-```csharp
-GrpcEnvironment.Initialize();
-
-using (Channel channel = new Channel("127.0.0.1:50052"))
-{
- var client = RouteGuide.NewStub(channel);
-
- // YOUR CODE GOES HERE
-}
-
-GrpcEnvironment.Shutdown();
-```
-
-### Calling service methods
-
-Now let's look at how we call our service methods. gRPC C# provides asynchronous versions of each of the supported method types. For convenience,
-gRPC C# also provides a synchronous method stub, but only for simple (single request/single response) RPCs.
-
-#### Simple RPC
-
-Calling the simple RPC `GetFeature` in a synchronous way is nearly as straightforward as calling a local method.
-
-```csharp
-Point request = Point.CreateBuilder().SetLatitude(409146138).SetLongitude(-746188906).Build();
-Feature feature = client.GetFeature(request);
-```
-
-As you can see, we create and populate a request protocol buffer object (in our case `Point`), and call the desired method on the client object, passing it the request. If the RPC finishes with success, the response protocol buffer (in our case `Feature`) will be returned. Otherwise, an exception of type `RpcException` will be thrown, indicating the status code of the problem.
-
-Alternatively, if you are in async context, you can call an asynchronous version of the method (and use `await` keyword to await the result):
-```csharp
-Point request = Point.CreateBuilder().SetLatitude(409146138).SetLongitude(-746188906).Build();
-Feature feature = await client.GetFeatureAsync(request);
-```
-
-#### Streaming RPCs
-
-Now let's look at our streaming methods. If you've already read [Creating the server](#server) some of this may look very familiar - streaming RPCs are implemented in a similar way on both sides. The difference with respect to simple call is that the client methods return an instance of a call object, that provides access to request/response streams and/or asynchronous result (depending on the streaming type you are using).
-
-Here's where we call the server-side streaming method `ListFeatures`, which has property `ReponseStream` of type `IAsyncEnumerator`
-
-```csharp
-using (var call = client.ListFeatures(request))
-{
- while (await call.ResponseStream.MoveNext())
- {
- Feature feature = call.ResponseStream.Current;
- Console.WriteLine("Received " + feature.ToString());
- }
-}
-```
-
-The client-side streaming method `RecordRoute` is similar, except we use the property `RequestStream` to write the requests one by one using `WriteAsync` and eventually signal that no more request will be send using `CompleteAsync`. The method result can be obtained through the property
-`Result`.
-```csharp
-using (var call = client.RecordRoute())
-{
- foreach (var point in points)
- {
- await call.RequestStream.WriteAsync(point);
- }
- await call.RequestStream.CompleteAsync();
-
- RouteSummary summary = await call.Result;
-}
-```
-
-Finally, let's look at our bidirectional streaming RPC `RouteChat`. In this case, we write the request to `RequestStream` and receive the responses from `ResponseStream`. As you can see from the example, the streams are independent of each other.
-
-```csharp
- using (var call = client.RouteChat())
- {
- var responseReaderTask = Task.Run(async () =>
- {
- while (await call.ResponseStream.MoveNext())
- {
- var note = call.ResponseStream.Current;
- Console.WriteLine("Received " + note);
- }
- });
-
- foreach (RouteNote request in requests)
- {
- await call.RequestStream.WriteAsync(request);
- }
- await call.RequestStream.CompleteAsync();
- await responseReaderTask;
-}
-```
-
-## Try it out!
-
-Build client and server:
-
-Open the solution `grpc-common/csharp/route_guide/RouteGuide.sln` from Visual Studio (or Monodevelop on Linux) and hit "Build".
-
-Run the server, which will listen on port 50052:
-```
-> cd RouteGuideServer/bin/Debug
-> RouteGuideServer.exe
-```
-
-Run the client (in a different terminal):
-```
-> cd RouteGuideClient/bin/Debug
-> RouteGuideClient.exe
-```
-
-You can also run the server and client directly from Visual Studio.
-
-On Linux or Mac, use `mono RouteGuideServer.exe` and `mono RouteGuideClient.exe` to run the server and client.
diff --git a/csharp/route_guide/RouteGuide.sln b/csharp/route_guide/RouteGuide.sln
deleted file mode 100644
index 0b79fdc..0000000
--- a/csharp/route_guide/RouteGuide.sln
+++ /dev/null
@@ -1,39 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuide", "RouteGuide\RouteGuide.csproj", "{49954D9C-5F17-4662-96B2-73BE833DD81A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuideClient", "RouteGuideClient\RouteGuideClient.csproj", "{D47BE663-4DE3-4206-B7A8-EA3FA066DADC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuideServer", "RouteGuideServer\RouteGuideServer.csproj", "{4B7C7794-BE24-4477-ACE7-18259EB73D27}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{2F6B184B-A576-4F21-AF2E-27E73D1FC96E}"
- ProjectSection(SolutionItems) = preProject
- .nuget\packages.config = .nuget\packages.config
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {49954D9C-5F17-4662-96B2-73BE833DD81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {49954D9C-5F17-4662-96B2-73BE833DD81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {49954D9C-5F17-4662-96B2-73BE833DD81A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {49954D9C-5F17-4662-96B2-73BE833DD81A}.Release|Any CPU.Build.0 = Release|Any CPU
- {D47BE663-4DE3-4206-B7A8-EA3FA066DADC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D47BE663-4DE3-4206-B7A8-EA3FA066DADC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D47BE663-4DE3-4206-B7A8-EA3FA066DADC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D47BE663-4DE3-4206-B7A8-EA3FA066DADC}.Release|Any CPU.Build.0 = Release|Any CPU
- {4B7C7794-BE24-4477-ACE7-18259EB73D27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4B7C7794-BE24-4477-ACE7-18259EB73D27}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4B7C7794-BE24-4477-ACE7-18259EB73D27}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4B7C7794-BE24-4477-ACE7-18259EB73D27}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/csharp/route_guide/RouteGuide/Properties/AssemblyInfo.cs b/csharp/route_guide/RouteGuide/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9c3441e..0000000
--- a/csharp/route_guide/RouteGuide/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("RouteGuide")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("RouteGuide")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ef6b85bc-ac27-46de-8714-a658236cc6fb")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/csharp/route_guide/RouteGuide/RouteGuide.cs b/csharp/route_guide/RouteGuide/RouteGuide.cs
deleted file mode 100644
index 80508bc..0000000
--- a/csharp/route_guide/RouteGuide/RouteGuide.cs
+++ /dev/null
@@ -1,1873 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: route_guide.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.ProtocolBuffers;
-using pbc = global::Google.ProtocolBuffers.Collections;
-using pbd = global::Google.ProtocolBuffers.Descriptors;
-using scg = global::System.Collections.Generic;
-namespace examples {
-
- namespace Proto {
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class RouteGuide {
-
- #region Extension registration
- public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
- }
- #endregion
- #region Static variables
- internal static pbd::MessageDescriptor internal__static_examples_Point__Descriptor;
- internal static pb::FieldAccess.FieldAccessorTable internal__static_examples_Point__FieldAccessorTable;
- internal static pbd::MessageDescriptor internal__static_examples_Rectangle__Descriptor;
- internal static pb::FieldAccess.FieldAccessorTable internal__static_examples_Rectangle__FieldAccessorTable;
- internal static pbd::MessageDescriptor internal__static_examples_Feature__Descriptor;
- internal static pb::FieldAccess.FieldAccessorTable internal__static_examples_Feature__FieldAccessorTable;
- internal static pbd::MessageDescriptor internal__static_examples_RouteNote__Descriptor;
- internal static pb::FieldAccess.FieldAccessorTable internal__static_examples_RouteNote__FieldAccessorTable;
- internal static pbd::MessageDescriptor internal__static_examples_RouteSummary__Descriptor;
- internal static pb::FieldAccess.FieldAccessorTable internal__static_examples_RouteSummary__FieldAccessorTable;
- #endregion
- #region Descriptor
- public static pbd::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbd::FileDescriptor descriptor;
-
- static RouteGuide() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "ChFyb3V0ZV9ndWlkZS5wcm90bxIIZXhhbXBsZXMiLAoFUG9pbnQSEAoIbGF0",
- "aXR1ZGUYASABKAUSEQoJbG9uZ2l0dWRlGAIgASgFIkUKCVJlY3RhbmdsZRIb",
- "CgJsbxgBIAEoCzIPLmV4YW1wbGVzLlBvaW50EhsKAmhpGAIgASgLMg8uZXhh",
- "bXBsZXMuUG9pbnQiOgoHRmVhdHVyZRIMCgRuYW1lGAEgASgJEiEKCGxvY2F0",
- "aW9uGAIgASgLMg8uZXhhbXBsZXMuUG9pbnQiPwoJUm91dGVOb3RlEiEKCGxv",
- "Y2F0aW9uGAEgASgLMg8uZXhhbXBsZXMuUG9pbnQSDwoHbWVzc2FnZRgCIAEo",
- "CSJiCgxSb3V0ZVN1bW1hcnkSEwoLcG9pbnRfY291bnQYASABKAUSFQoNZmVh",
- "dHVyZV9jb3VudBgCIAEoBRIQCghkaXN0YW5jZRgDIAEoBRIUCgxlbGFwc2Vk",
- "X3RpbWUYBCABKAUy9QEKClJvdXRlR3VpZGUSMgoKR2V0RmVhdHVyZRIPLmV4",
- "YW1wbGVzLlBvaW50GhEuZXhhbXBsZXMuRmVhdHVyZSIAEjoKDExpc3RGZWF0",
- "dXJlcxITLmV4YW1wbGVzLlJlY3RhbmdsZRoRLmV4YW1wbGVzLkZlYXR1cmUi",
- "ADABEjoKC1JlY29yZFJvdXRlEg8uZXhhbXBsZXMuUG9pbnQaFi5leGFtcGxl",
- "cy5Sb3V0ZVN1bW1hcnkiACgBEjsKCVJvdXRlQ2hhdBITLmV4YW1wbGVzLlJv",
- "dXRlTm90ZRoTLmV4YW1wbGVzLlJvdXRlTm90ZSIAKAEwAQ=="));
- pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
- descriptor = root;
- internal__static_examples_Point__Descriptor = Descriptor.MessageTypes[0];
- internal__static_examples_Point__FieldAccessorTable =
- new pb::FieldAccess.FieldAccessorTable(internal__static_examples_Point__Descriptor,
- new string[] { "Latitude", "Longitude", });
- internal__static_examples_Rectangle__Descriptor = Descriptor.MessageTypes[1];
- internal__static_examples_Rectangle__FieldAccessorTable =
- new pb::FieldAccess.FieldAccessorTable(internal__static_examples_Rectangle__Descriptor,
- new string[] { "Lo", "Hi", });
- internal__static_examples_Feature__Descriptor = Descriptor.MessageTypes[2];
- internal__static_examples_Feature__FieldAccessorTable =
- new pb::FieldAccess.FieldAccessorTable(internal__static_examples_Feature__Descriptor,
- new string[] { "Name", "Location", });
- internal__static_examples_RouteNote__Descriptor = Descriptor.MessageTypes[3];
- internal__static_examples_RouteNote__FieldAccessorTable =
- new pb::FieldAccess.FieldAccessorTable(internal__static_examples_RouteNote__Descriptor,
- new string[] { "Location", "Message", });
- internal__static_examples_RouteSummary__Descriptor = Descriptor.MessageTypes[4];
- internal__static_examples_RouteSummary__FieldAccessorTable =
- new pb::FieldAccess.FieldAccessorTable(internal__static_examples_RouteSummary__Descriptor,
- new string[] { "PointCount", "FeatureCount", "Distance", "ElapsedTime", });
- pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();
- RegisterAllExtensions(registry);
- return registry;
- };
- pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbd::FileDescriptor[] {
- }, assigner);
- }
- #endregion
-
- }
- }
- #region Messages
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Point : pb::GeneratedMessage {
- private Point() { }
- private static readonly Point defaultInstance = new Point().MakeReadOnly();
- private static readonly string[] _pointFieldNames = new string[] { "latitude", "longitude" };
- private static readonly uint[] _pointFieldTags = new uint[] { 8, 16 };
- public static Point DefaultInstance {
- get { return defaultInstance; }
- }
-
- public override Point DefaultInstanceForType {
- get { return DefaultInstance; }
- }
-
- protected override Point ThisMessage {
- get { return this; }
- }
-
- public static pbd::MessageDescriptor Descriptor {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_Point__Descriptor; }
- }
-
- protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_Point__FieldAccessorTable; }
- }
-
- public const int LatitudeFieldNumber = 1;
- private bool hasLatitude;
- private int latitude_;
- public bool HasLatitude {
- get { return hasLatitude; }
- }
- public int Latitude {
- get { return latitude_; }
- }
-
- public const int LongitudeFieldNumber = 2;
- private bool hasLongitude;
- private int longitude_;
- public bool HasLongitude {
- get { return hasLongitude; }
- }
- public int Longitude {
- get { return longitude_; }
- }
-
- public override bool IsInitialized {
- get {
- return true;
- }
- }
-
- public override void WriteTo(pb::ICodedOutputStream output) {
- CalcSerializedSize();
- string[] field_names = _pointFieldNames;
- if (hasLatitude) {
- output.WriteInt32(1, field_names[0], Latitude);
- }
- if (hasLongitude) {
- output.WriteInt32(2, field_names[1], Longitude);
- }
- UnknownFields.WriteTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public override int SerializedSize {
- get {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
- return CalcSerializedSize();
- }
- }
-
- private int CalcSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasLatitude) {
- size += pb::CodedOutputStream.ComputeInt32Size(1, Latitude);
- }
- if (hasLongitude) {
- size += pb::CodedOutputStream.ComputeInt32Size(2, Longitude);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
- }
- public static Point ParseFrom(pb::ByteString data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static Point ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static Point ParseFrom(byte[] data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static Point ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static Point ParseFrom(global::System.IO.Stream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static Point ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- public static Point ParseDelimitedFrom(global::System.IO.Stream input) {
- return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
- }
- public static Point ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
- }
- public static Point ParseFrom(pb::ICodedInputStream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static Point ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- private Point MakeReadOnly() {
- return this;
- }
-
- public static Builder CreateBuilder() { return new Builder(); }
- public override Builder ToBuilder() { return CreateBuilder(this); }
- public override Builder CreateBuilderForType() { return new Builder(); }
- public static Builder CreateBuilder(Point prototype) {
- return new Builder(prototype);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Builder : pb::GeneratedBuilder {
- protected override Builder ThisBuilder {
- get { return this; }
- }
- public Builder() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- }
- internal Builder(Point cloneFrom) {
- result = cloneFrom;
- resultIsReadOnly = true;
- }
-
- private bool resultIsReadOnly;
- private Point result;
-
- private Point PrepareBuilder() {
- if (resultIsReadOnly) {
- Point original = result;
- result = new Point();
- resultIsReadOnly = false;
- MergeFrom(original);
- }
- return result;
- }
-
- public override bool IsInitialized {
- get { return result.IsInitialized; }
- }
-
- protected override Point MessageBeingBuilt {
- get { return PrepareBuilder(); }
- }
-
- public override Builder Clear() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- return this;
- }
-
- public override Builder Clone() {
- if (resultIsReadOnly) {
- return new Builder(result);
- } else {
- return new Builder().MergeFrom(result);
- }
- }
-
- public override pbd::MessageDescriptor DescriptorForType {
- get { return global::examples.Point.Descriptor; }
- }
-
- public override Point DefaultInstanceForType {
- get { return global::examples.Point.DefaultInstance; }
- }
-
- public override Point BuildPartial() {
- if (resultIsReadOnly) {
- return result;
- }
- resultIsReadOnly = true;
- return result.MakeReadOnly();
- }
-
- public override Builder MergeFrom(pb::IMessage other) {
- if (other is Point) {
- return MergeFrom((Point) other);
- } else {
- base.MergeFrom(other);
- return this;
- }
- }
-
- public override Builder MergeFrom(Point other) {
- if (other == global::examples.Point.DefaultInstance) return this;
- PrepareBuilder();
- if (other.HasLatitude) {
- Latitude = other.Latitude;
- }
- if (other.HasLongitude) {
- Longitude = other.Longitude;
- }
- this.MergeUnknownFields(other.UnknownFields);
- return this;
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input) {
- return MergeFrom(input, pb::ExtensionRegistry.Empty);
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- PrepareBuilder();
- pb::UnknownFieldSet.Builder unknownFields = null;
- uint tag;
- string field_name;
- while (input.ReadTag(out tag, out field_name)) {
- if(tag == 0 && field_name != null) {
- int field_ordinal = global::System.Array.BinarySearch(_pointFieldNames, field_name, global::System.StringComparer.Ordinal);
- if(field_ordinal >= 0)
- tag = _pointFieldTags[field_ordinal];
- else {
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- continue;
- }
- }
- switch (tag) {
- case 0: {
- throw pb::InvalidProtocolBufferException.InvalidTag();
- }
- default: {
- if (pb::WireFormat.IsEndGroupTag(tag)) {
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- break;
- }
- case 8: {
- result.hasLatitude = input.ReadInt32(ref result.latitude_);
- break;
- }
- case 16: {
- result.hasLongitude = input.ReadInt32(ref result.longitude_);
- break;
- }
- }
- }
-
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
-
-
- public bool HasLatitude {
- get { return result.hasLatitude; }
- }
- public int Latitude {
- get { return result.Latitude; }
- set { SetLatitude(value); }
- }
- public Builder SetLatitude(int value) {
- PrepareBuilder();
- result.hasLatitude = true;
- result.latitude_ = value;
- return this;
- }
- public Builder ClearLatitude() {
- PrepareBuilder();
- result.hasLatitude = false;
- result.latitude_ = 0;
- return this;
- }
-
- public bool HasLongitude {
- get { return result.hasLongitude; }
- }
- public int Longitude {
- get { return result.Longitude; }
- set { SetLongitude(value); }
- }
- public Builder SetLongitude(int value) {
- PrepareBuilder();
- result.hasLongitude = true;
- result.longitude_ = value;
- return this;
- }
- public Builder ClearLongitude() {
- PrepareBuilder();
- result.hasLongitude = false;
- result.longitude_ = 0;
- return this;
- }
- }
- static Point() {
- object.ReferenceEquals(global::examples.Proto.RouteGuide.Descriptor, null);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Rectangle : pb::GeneratedMessage {
- private Rectangle() { }
- private static readonly Rectangle defaultInstance = new Rectangle().MakeReadOnly();
- private static readonly string[] _rectangleFieldNames = new string[] { "hi", "lo" };
- private static readonly uint[] _rectangleFieldTags = new uint[] { 18, 10 };
- public static Rectangle DefaultInstance {
- get { return defaultInstance; }
- }
-
- public override Rectangle DefaultInstanceForType {
- get { return DefaultInstance; }
- }
-
- protected override Rectangle ThisMessage {
- get { return this; }
- }
-
- public static pbd::MessageDescriptor Descriptor {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_Rectangle__Descriptor; }
- }
-
- protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_Rectangle__FieldAccessorTable; }
- }
-
- public const int LoFieldNumber = 1;
- private bool hasLo;
- private global::examples.Point lo_;
- public bool HasLo {
- get { return hasLo; }
- }
- public global::examples.Point Lo {
- get { return lo_ ?? global::examples.Point.DefaultInstance; }
- }
-
- public const int HiFieldNumber = 2;
- private bool hasHi;
- private global::examples.Point hi_;
- public bool HasHi {
- get { return hasHi; }
- }
- public global::examples.Point Hi {
- get { return hi_ ?? global::examples.Point.DefaultInstance; }
- }
-
- public override bool IsInitialized {
- get {
- return true;
- }
- }
-
- public override void WriteTo(pb::ICodedOutputStream output) {
- CalcSerializedSize();
- string[] field_names = _rectangleFieldNames;
- if (hasLo) {
- output.WriteMessage(1, field_names[1], Lo);
- }
- if (hasHi) {
- output.WriteMessage(2, field_names[0], Hi);
- }
- UnknownFields.WriteTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public override int SerializedSize {
- get {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
- return CalcSerializedSize();
- }
- }
-
- private int CalcSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasLo) {
- size += pb::CodedOutputStream.ComputeMessageSize(1, Lo);
- }
- if (hasHi) {
- size += pb::CodedOutputStream.ComputeMessageSize(2, Hi);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
- }
- public static Rectangle ParseFrom(pb::ByteString data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static Rectangle ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static Rectangle ParseFrom(byte[] data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static Rectangle ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static Rectangle ParseFrom(global::System.IO.Stream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static Rectangle ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- public static Rectangle ParseDelimitedFrom(global::System.IO.Stream input) {
- return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
- }
- public static Rectangle ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
- }
- public static Rectangle ParseFrom(pb::ICodedInputStream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static Rectangle ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- private Rectangle MakeReadOnly() {
- return this;
- }
-
- public static Builder CreateBuilder() { return new Builder(); }
- public override Builder ToBuilder() { return CreateBuilder(this); }
- public override Builder CreateBuilderForType() { return new Builder(); }
- public static Builder CreateBuilder(Rectangle prototype) {
- return new Builder(prototype);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Builder : pb::GeneratedBuilder {
- protected override Builder ThisBuilder {
- get { return this; }
- }
- public Builder() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- }
- internal Builder(Rectangle cloneFrom) {
- result = cloneFrom;
- resultIsReadOnly = true;
- }
-
- private bool resultIsReadOnly;
- private Rectangle result;
-
- private Rectangle PrepareBuilder() {
- if (resultIsReadOnly) {
- Rectangle original = result;
- result = new Rectangle();
- resultIsReadOnly = false;
- MergeFrom(original);
- }
- return result;
- }
-
- public override bool IsInitialized {
- get { return result.IsInitialized; }
- }
-
- protected override Rectangle MessageBeingBuilt {
- get { return PrepareBuilder(); }
- }
-
- public override Builder Clear() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- return this;
- }
-
- public override Builder Clone() {
- if (resultIsReadOnly) {
- return new Builder(result);
- } else {
- return new Builder().MergeFrom(result);
- }
- }
-
- public override pbd::MessageDescriptor DescriptorForType {
- get { return global::examples.Rectangle.Descriptor; }
- }
-
- public override Rectangle DefaultInstanceForType {
- get { return global::examples.Rectangle.DefaultInstance; }
- }
-
- public override Rectangle BuildPartial() {
- if (resultIsReadOnly) {
- return result;
- }
- resultIsReadOnly = true;
- return result.MakeReadOnly();
- }
-
- public override Builder MergeFrom(pb::IMessage other) {
- if (other is Rectangle) {
- return MergeFrom((Rectangle) other);
- } else {
- base.MergeFrom(other);
- return this;
- }
- }
-
- public override Builder MergeFrom(Rectangle other) {
- if (other == global::examples.Rectangle.DefaultInstance) return this;
- PrepareBuilder();
- if (other.HasLo) {
- MergeLo(other.Lo);
- }
- if (other.HasHi) {
- MergeHi(other.Hi);
- }
- this.MergeUnknownFields(other.UnknownFields);
- return this;
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input) {
- return MergeFrom(input, pb::ExtensionRegistry.Empty);
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- PrepareBuilder();
- pb::UnknownFieldSet.Builder unknownFields = null;
- uint tag;
- string field_name;
- while (input.ReadTag(out tag, out field_name)) {
- if(tag == 0 && field_name != null) {
- int field_ordinal = global::System.Array.BinarySearch(_rectangleFieldNames, field_name, global::System.StringComparer.Ordinal);
- if(field_ordinal >= 0)
- tag = _rectangleFieldTags[field_ordinal];
- else {
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- continue;
- }
- }
- switch (tag) {
- case 0: {
- throw pb::InvalidProtocolBufferException.InvalidTag();
- }
- default: {
- if (pb::WireFormat.IsEndGroupTag(tag)) {
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- break;
- }
- case 10: {
- global::examples.Point.Builder subBuilder = global::examples.Point.CreateBuilder();
- if (result.hasLo) {
- subBuilder.MergeFrom(Lo);
- }
- input.ReadMessage(subBuilder, extensionRegistry);
- Lo = subBuilder.BuildPartial();
- break;
- }
- case 18: {
- global::examples.Point.Builder subBuilder = global::examples.Point.CreateBuilder();
- if (result.hasHi) {
- subBuilder.MergeFrom(Hi);
- }
- input.ReadMessage(subBuilder, extensionRegistry);
- Hi = subBuilder.BuildPartial();
- break;
- }
- }
- }
-
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
-
-
- public bool HasLo {
- get { return result.hasLo; }
- }
- public global::examples.Point Lo {
- get { return result.Lo; }
- set { SetLo(value); }
- }
- public Builder SetLo(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasLo = true;
- result.lo_ = value;
- return this;
- }
- public Builder SetLo(global::examples.Point.Builder builderForValue) {
- pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
- PrepareBuilder();
- result.hasLo = true;
- result.lo_ = builderForValue.Build();
- return this;
- }
- public Builder MergeLo(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- if (result.hasLo &&
- result.lo_ != global::examples.Point.DefaultInstance) {
- result.lo_ = global::examples.Point.CreateBuilder(result.lo_).MergeFrom(value).BuildPartial();
- } else {
- result.lo_ = value;
- }
- result.hasLo = true;
- return this;
- }
- public Builder ClearLo() {
- PrepareBuilder();
- result.hasLo = false;
- result.lo_ = null;
- return this;
- }
-
- public bool HasHi {
- get { return result.hasHi; }
- }
- public global::examples.Point Hi {
- get { return result.Hi; }
- set { SetHi(value); }
- }
- public Builder SetHi(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasHi = true;
- result.hi_ = value;
- return this;
- }
- public Builder SetHi(global::examples.Point.Builder builderForValue) {
- pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
- PrepareBuilder();
- result.hasHi = true;
- result.hi_ = builderForValue.Build();
- return this;
- }
- public Builder MergeHi(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- if (result.hasHi &&
- result.hi_ != global::examples.Point.DefaultInstance) {
- result.hi_ = global::examples.Point.CreateBuilder(result.hi_).MergeFrom(value).BuildPartial();
- } else {
- result.hi_ = value;
- }
- result.hasHi = true;
- return this;
- }
- public Builder ClearHi() {
- PrepareBuilder();
- result.hasHi = false;
- result.hi_ = null;
- return this;
- }
- }
- static Rectangle() {
- object.ReferenceEquals(global::examples.Proto.RouteGuide.Descriptor, null);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Feature : pb::GeneratedMessage {
- private Feature() { }
- private static readonly Feature defaultInstance = new Feature().MakeReadOnly();
- private static readonly string[] _featureFieldNames = new string[] { "location", "name" };
- private static readonly uint[] _featureFieldTags = new uint[] { 18, 10 };
- public static Feature DefaultInstance {
- get { return defaultInstance; }
- }
-
- public override Feature DefaultInstanceForType {
- get { return DefaultInstance; }
- }
-
- protected override Feature ThisMessage {
- get { return this; }
- }
-
- public static pbd::MessageDescriptor Descriptor {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_Feature__Descriptor; }
- }
-
- protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_Feature__FieldAccessorTable; }
- }
-
- public const int NameFieldNumber = 1;
- private bool hasName;
- private string name_ = "";
- public bool HasName {
- get { return hasName; }
- }
- public string Name {
- get { return name_; }
- }
-
- public const int LocationFieldNumber = 2;
- private bool hasLocation;
- private global::examples.Point location_;
- public bool HasLocation {
- get { return hasLocation; }
- }
- public global::examples.Point Location {
- get { return location_ ?? global::examples.Point.DefaultInstance; }
- }
-
- public override bool IsInitialized {
- get {
- return true;
- }
- }
-
- public override void WriteTo(pb::ICodedOutputStream output) {
- CalcSerializedSize();
- string[] field_names = _featureFieldNames;
- if (hasName) {
- output.WriteString(1, field_names[1], Name);
- }
- if (hasLocation) {
- output.WriteMessage(2, field_names[0], Location);
- }
- UnknownFields.WriteTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public override int SerializedSize {
- get {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
- return CalcSerializedSize();
- }
- }
-
- private int CalcSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasName) {
- size += pb::CodedOutputStream.ComputeStringSize(1, Name);
- }
- if (hasLocation) {
- size += pb::CodedOutputStream.ComputeMessageSize(2, Location);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
- }
- public static Feature ParseFrom(pb::ByteString data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static Feature ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static Feature ParseFrom(byte[] data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static Feature ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static Feature ParseFrom(global::System.IO.Stream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static Feature ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- public static Feature ParseDelimitedFrom(global::System.IO.Stream input) {
- return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
- }
- public static Feature ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
- }
- public static Feature ParseFrom(pb::ICodedInputStream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static Feature ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- private Feature MakeReadOnly() {
- return this;
- }
-
- public static Builder CreateBuilder() { return new Builder(); }
- public override Builder ToBuilder() { return CreateBuilder(this); }
- public override Builder CreateBuilderForType() { return new Builder(); }
- public static Builder CreateBuilder(Feature prototype) {
- return new Builder(prototype);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Builder : pb::GeneratedBuilder {
- protected override Builder ThisBuilder {
- get { return this; }
- }
- public Builder() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- }
- internal Builder(Feature cloneFrom) {
- result = cloneFrom;
- resultIsReadOnly = true;
- }
-
- private bool resultIsReadOnly;
- private Feature result;
-
- private Feature PrepareBuilder() {
- if (resultIsReadOnly) {
- Feature original = result;
- result = new Feature();
- resultIsReadOnly = false;
- MergeFrom(original);
- }
- return result;
- }
-
- public override bool IsInitialized {
- get { return result.IsInitialized; }
- }
-
- protected override Feature MessageBeingBuilt {
- get { return PrepareBuilder(); }
- }
-
- public override Builder Clear() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- return this;
- }
-
- public override Builder Clone() {
- if (resultIsReadOnly) {
- return new Builder(result);
- } else {
- return new Builder().MergeFrom(result);
- }
- }
-
- public override pbd::MessageDescriptor DescriptorForType {
- get { return global::examples.Feature.Descriptor; }
- }
-
- public override Feature DefaultInstanceForType {
- get { return global::examples.Feature.DefaultInstance; }
- }
-
- public override Feature BuildPartial() {
- if (resultIsReadOnly) {
- return result;
- }
- resultIsReadOnly = true;
- return result.MakeReadOnly();
- }
-
- public override Builder MergeFrom(pb::IMessage other) {
- if (other is Feature) {
- return MergeFrom((Feature) other);
- } else {
- base.MergeFrom(other);
- return this;
- }
- }
-
- public override Builder MergeFrom(Feature other) {
- if (other == global::examples.Feature.DefaultInstance) return this;
- PrepareBuilder();
- if (other.HasName) {
- Name = other.Name;
- }
- if (other.HasLocation) {
- MergeLocation(other.Location);
- }
- this.MergeUnknownFields(other.UnknownFields);
- return this;
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input) {
- return MergeFrom(input, pb::ExtensionRegistry.Empty);
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- PrepareBuilder();
- pb::UnknownFieldSet.Builder unknownFields = null;
- uint tag;
- string field_name;
- while (input.ReadTag(out tag, out field_name)) {
- if(tag == 0 && field_name != null) {
- int field_ordinal = global::System.Array.BinarySearch(_featureFieldNames, field_name, global::System.StringComparer.Ordinal);
- if(field_ordinal >= 0)
- tag = _featureFieldTags[field_ordinal];
- else {
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- continue;
- }
- }
- switch (tag) {
- case 0: {
- throw pb::InvalidProtocolBufferException.InvalidTag();
- }
- default: {
- if (pb::WireFormat.IsEndGroupTag(tag)) {
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- break;
- }
- case 10: {
- result.hasName = input.ReadString(ref result.name_);
- break;
- }
- case 18: {
- global::examples.Point.Builder subBuilder = global::examples.Point.CreateBuilder();
- if (result.hasLocation) {
- subBuilder.MergeFrom(Location);
- }
- input.ReadMessage(subBuilder, extensionRegistry);
- Location = subBuilder.BuildPartial();
- break;
- }
- }
- }
-
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
-
-
- public bool HasName {
- get { return result.hasName; }
- }
- public string Name {
- get { return result.Name; }
- set { SetName(value); }
- }
- public Builder SetName(string value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasName = true;
- result.name_ = value;
- return this;
- }
- public Builder ClearName() {
- PrepareBuilder();
- result.hasName = false;
- result.name_ = "";
- return this;
- }
-
- public bool HasLocation {
- get { return result.hasLocation; }
- }
- public global::examples.Point Location {
- get { return result.Location; }
- set { SetLocation(value); }
- }
- public Builder SetLocation(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasLocation = true;
- result.location_ = value;
- return this;
- }
- public Builder SetLocation(global::examples.Point.Builder builderForValue) {
- pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
- PrepareBuilder();
- result.hasLocation = true;
- result.location_ = builderForValue.Build();
- return this;
- }
- public Builder MergeLocation(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- if (result.hasLocation &&
- result.location_ != global::examples.Point.DefaultInstance) {
- result.location_ = global::examples.Point.CreateBuilder(result.location_).MergeFrom(value).BuildPartial();
- } else {
- result.location_ = value;
- }
- result.hasLocation = true;
- return this;
- }
- public Builder ClearLocation() {
- PrepareBuilder();
- result.hasLocation = false;
- result.location_ = null;
- return this;
- }
- }
- static Feature() {
- object.ReferenceEquals(global::examples.Proto.RouteGuide.Descriptor, null);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class RouteNote : pb::GeneratedMessage {
- private RouteNote() { }
- private static readonly RouteNote defaultInstance = new RouteNote().MakeReadOnly();
- private static readonly string[] _routeNoteFieldNames = new string[] { "location", "message" };
- private static readonly uint[] _routeNoteFieldTags = new uint[] { 10, 18 };
- public static RouteNote DefaultInstance {
- get { return defaultInstance; }
- }
-
- public override RouteNote DefaultInstanceForType {
- get { return DefaultInstance; }
- }
-
- protected override RouteNote ThisMessage {
- get { return this; }
- }
-
- public static pbd::MessageDescriptor Descriptor {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_RouteNote__Descriptor; }
- }
-
- protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_RouteNote__FieldAccessorTable; }
- }
-
- public const int LocationFieldNumber = 1;
- private bool hasLocation;
- private global::examples.Point location_;
- public bool HasLocation {
- get { return hasLocation; }
- }
- public global::examples.Point Location {
- get { return location_ ?? global::examples.Point.DefaultInstance; }
- }
-
- public const int MessageFieldNumber = 2;
- private bool hasMessage;
- private string message_ = "";
- public bool HasMessage {
- get { return hasMessage; }
- }
- public string Message {
- get { return message_; }
- }
-
- public override bool IsInitialized {
- get {
- return true;
- }
- }
-
- public override void WriteTo(pb::ICodedOutputStream output) {
- CalcSerializedSize();
- string[] field_names = _routeNoteFieldNames;
- if (hasLocation) {
- output.WriteMessage(1, field_names[0], Location);
- }
- if (hasMessage) {
- output.WriteString(2, field_names[1], Message);
- }
- UnknownFields.WriteTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public override int SerializedSize {
- get {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
- return CalcSerializedSize();
- }
- }
-
- private int CalcSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasLocation) {
- size += pb::CodedOutputStream.ComputeMessageSize(1, Location);
- }
- if (hasMessage) {
- size += pb::CodedOutputStream.ComputeStringSize(2, Message);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
- }
- public static RouteNote ParseFrom(pb::ByteString data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static RouteNote ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static RouteNote ParseFrom(byte[] data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static RouteNote ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static RouteNote ParseFrom(global::System.IO.Stream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static RouteNote ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- public static RouteNote ParseDelimitedFrom(global::System.IO.Stream input) {
- return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
- }
- public static RouteNote ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
- }
- public static RouteNote ParseFrom(pb::ICodedInputStream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static RouteNote ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- private RouteNote MakeReadOnly() {
- return this;
- }
-
- public static Builder CreateBuilder() { return new Builder(); }
- public override Builder ToBuilder() { return CreateBuilder(this); }
- public override Builder CreateBuilderForType() { return new Builder(); }
- public static Builder CreateBuilder(RouteNote prototype) {
- return new Builder(prototype);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Builder : pb::GeneratedBuilder {
- protected override Builder ThisBuilder {
- get { return this; }
- }
- public Builder() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- }
- internal Builder(RouteNote cloneFrom) {
- result = cloneFrom;
- resultIsReadOnly = true;
- }
-
- private bool resultIsReadOnly;
- private RouteNote result;
-
- private RouteNote PrepareBuilder() {
- if (resultIsReadOnly) {
- RouteNote original = result;
- result = new RouteNote();
- resultIsReadOnly = false;
- MergeFrom(original);
- }
- return result;
- }
-
- public override bool IsInitialized {
- get { return result.IsInitialized; }
- }
-
- protected override RouteNote MessageBeingBuilt {
- get { return PrepareBuilder(); }
- }
-
- public override Builder Clear() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- return this;
- }
-
- public override Builder Clone() {
- if (resultIsReadOnly) {
- return new Builder(result);
- } else {
- return new Builder().MergeFrom(result);
- }
- }
-
- public override pbd::MessageDescriptor DescriptorForType {
- get { return global::examples.RouteNote.Descriptor; }
- }
-
- public override RouteNote DefaultInstanceForType {
- get { return global::examples.RouteNote.DefaultInstance; }
- }
-
- public override RouteNote BuildPartial() {
- if (resultIsReadOnly) {
- return result;
- }
- resultIsReadOnly = true;
- return result.MakeReadOnly();
- }
-
- public override Builder MergeFrom(pb::IMessage other) {
- if (other is RouteNote) {
- return MergeFrom((RouteNote) other);
- } else {
- base.MergeFrom(other);
- return this;
- }
- }
-
- public override Builder MergeFrom(RouteNote other) {
- if (other == global::examples.RouteNote.DefaultInstance) return this;
- PrepareBuilder();
- if (other.HasLocation) {
- MergeLocation(other.Location);
- }
- if (other.HasMessage) {
- Message = other.Message;
- }
- this.MergeUnknownFields(other.UnknownFields);
- return this;
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input) {
- return MergeFrom(input, pb::ExtensionRegistry.Empty);
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- PrepareBuilder();
- pb::UnknownFieldSet.Builder unknownFields = null;
- uint tag;
- string field_name;
- while (input.ReadTag(out tag, out field_name)) {
- if(tag == 0 && field_name != null) {
- int field_ordinal = global::System.Array.BinarySearch(_routeNoteFieldNames, field_name, global::System.StringComparer.Ordinal);
- if(field_ordinal >= 0)
- tag = _routeNoteFieldTags[field_ordinal];
- else {
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- continue;
- }
- }
- switch (tag) {
- case 0: {
- throw pb::InvalidProtocolBufferException.InvalidTag();
- }
- default: {
- if (pb::WireFormat.IsEndGroupTag(tag)) {
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- break;
- }
- case 10: {
- global::examples.Point.Builder subBuilder = global::examples.Point.CreateBuilder();
- if (result.hasLocation) {
- subBuilder.MergeFrom(Location);
- }
- input.ReadMessage(subBuilder, extensionRegistry);
- Location = subBuilder.BuildPartial();
- break;
- }
- case 18: {
- result.hasMessage = input.ReadString(ref result.message_);
- break;
- }
- }
- }
-
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
-
-
- public bool HasLocation {
- get { return result.hasLocation; }
- }
- public global::examples.Point Location {
- get { return result.Location; }
- set { SetLocation(value); }
- }
- public Builder SetLocation(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasLocation = true;
- result.location_ = value;
- return this;
- }
- public Builder SetLocation(global::examples.Point.Builder builderForValue) {
- pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
- PrepareBuilder();
- result.hasLocation = true;
- result.location_ = builderForValue.Build();
- return this;
- }
- public Builder MergeLocation(global::examples.Point value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- if (result.hasLocation &&
- result.location_ != global::examples.Point.DefaultInstance) {
- result.location_ = global::examples.Point.CreateBuilder(result.location_).MergeFrom(value).BuildPartial();
- } else {
- result.location_ = value;
- }
- result.hasLocation = true;
- return this;
- }
- public Builder ClearLocation() {
- PrepareBuilder();
- result.hasLocation = false;
- result.location_ = null;
- return this;
- }
-
- public bool HasMessage {
- get { return result.hasMessage; }
- }
- public string Message {
- get { return result.Message; }
- set { SetMessage(value); }
- }
- public Builder SetMessage(string value) {
- pb::ThrowHelper.ThrowIfNull(value, "value");
- PrepareBuilder();
- result.hasMessage = true;
- result.message_ = value;
- return this;
- }
- public Builder ClearMessage() {
- PrepareBuilder();
- result.hasMessage = false;
- result.message_ = "";
- return this;
- }
- }
- static RouteNote() {
- object.ReferenceEquals(global::examples.Proto.RouteGuide.Descriptor, null);
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class RouteSummary : pb::GeneratedMessage {
- private RouteSummary() { }
- private static readonly RouteSummary defaultInstance = new RouteSummary().MakeReadOnly();
- private static readonly string[] _routeSummaryFieldNames = new string[] { "distance", "elapsed_time", "feature_count", "point_count" };
- private static readonly uint[] _routeSummaryFieldTags = new uint[] { 24, 32, 16, 8 };
- public static RouteSummary DefaultInstance {
- get { return defaultInstance; }
- }
-
- public override RouteSummary DefaultInstanceForType {
- get { return DefaultInstance; }
- }
-
- protected override RouteSummary ThisMessage {
- get { return this; }
- }
-
- public static pbd::MessageDescriptor Descriptor {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_RouteSummary__Descriptor; }
- }
-
- protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors {
- get { return global::examples.Proto.RouteGuide.internal__static_examples_RouteSummary__FieldAccessorTable; }
- }
-
- public const int PointCountFieldNumber = 1;
- private bool hasPointCount;
- private int pointCount_;
- public bool HasPointCount {
- get { return hasPointCount; }
- }
- public int PointCount {
- get { return pointCount_; }
- }
-
- public const int FeatureCountFieldNumber = 2;
- private bool hasFeatureCount;
- private int featureCount_;
- public bool HasFeatureCount {
- get { return hasFeatureCount; }
- }
- public int FeatureCount {
- get { return featureCount_; }
- }
-
- public const int DistanceFieldNumber = 3;
- private bool hasDistance;
- private int distance_;
- public bool HasDistance {
- get { return hasDistance; }
- }
- public int Distance {
- get { return distance_; }
- }
-
- public const int ElapsedTimeFieldNumber = 4;
- private bool hasElapsedTime;
- private int elapsedTime_;
- public bool HasElapsedTime {
- get { return hasElapsedTime; }
- }
- public int ElapsedTime {
- get { return elapsedTime_; }
- }
-
- public override bool IsInitialized {
- get {
- return true;
- }
- }
-
- public override void WriteTo(pb::ICodedOutputStream output) {
- CalcSerializedSize();
- string[] field_names = _routeSummaryFieldNames;
- if (hasPointCount) {
- output.WriteInt32(1, field_names[3], PointCount);
- }
- if (hasFeatureCount) {
- output.WriteInt32(2, field_names[2], FeatureCount);
- }
- if (hasDistance) {
- output.WriteInt32(3, field_names[0], Distance);
- }
- if (hasElapsedTime) {
- output.WriteInt32(4, field_names[1], ElapsedTime);
- }
- UnknownFields.WriteTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public override int SerializedSize {
- get {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
- return CalcSerializedSize();
- }
- }
-
- private int CalcSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasPointCount) {
- size += pb::CodedOutputStream.ComputeInt32Size(1, PointCount);
- }
- if (hasFeatureCount) {
- size += pb::CodedOutputStream.ComputeInt32Size(2, FeatureCount);
- }
- if (hasDistance) {
- size += pb::CodedOutputStream.ComputeInt32Size(3, Distance);
- }
- if (hasElapsedTime) {
- size += pb::CodedOutputStream.ComputeInt32Size(4, ElapsedTime);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
- }
- public static RouteSummary ParseFrom(pb::ByteString data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static RouteSummary ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static RouteSummary ParseFrom(byte[] data) {
- return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
- }
- public static RouteSummary ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
- }
- public static RouteSummary ParseFrom(global::System.IO.Stream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static RouteSummary ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- public static RouteSummary ParseDelimitedFrom(global::System.IO.Stream input) {
- return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
- }
- public static RouteSummary ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
- return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
- }
- public static RouteSummary ParseFrom(pb::ICodedInputStream input) {
- return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
- }
- public static RouteSummary ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
- }
- private RouteSummary MakeReadOnly() {
- return this;
- }
-
- public static Builder CreateBuilder() { return new Builder(); }
- public override Builder ToBuilder() { return CreateBuilder(this); }
- public override Builder CreateBuilderForType() { return new Builder(); }
- public static Builder CreateBuilder(RouteSummary prototype) {
- return new Builder(prototype);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public sealed partial class Builder : pb::GeneratedBuilder {
- protected override Builder ThisBuilder {
- get { return this; }
- }
- public Builder() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- }
- internal Builder(RouteSummary cloneFrom) {
- result = cloneFrom;
- resultIsReadOnly = true;
- }
-
- private bool resultIsReadOnly;
- private RouteSummary result;
-
- private RouteSummary PrepareBuilder() {
- if (resultIsReadOnly) {
- RouteSummary original = result;
- result = new RouteSummary();
- resultIsReadOnly = false;
- MergeFrom(original);
- }
- return result;
- }
-
- public override bool IsInitialized {
- get { return result.IsInitialized; }
- }
-
- protected override RouteSummary MessageBeingBuilt {
- get { return PrepareBuilder(); }
- }
-
- public override Builder Clear() {
- result = DefaultInstance;
- resultIsReadOnly = true;
- return this;
- }
-
- public override Builder Clone() {
- if (resultIsReadOnly) {
- return new Builder(result);
- } else {
- return new Builder().MergeFrom(result);
- }
- }
-
- public override pbd::MessageDescriptor DescriptorForType {
- get { return global::examples.RouteSummary.Descriptor; }
- }
-
- public override RouteSummary DefaultInstanceForType {
- get { return global::examples.RouteSummary.DefaultInstance; }
- }
-
- public override RouteSummary BuildPartial() {
- if (resultIsReadOnly) {
- return result;
- }
- resultIsReadOnly = true;
- return result.MakeReadOnly();
- }
-
- public override Builder MergeFrom(pb::IMessage other) {
- if (other is RouteSummary) {
- return MergeFrom((RouteSummary) other);
- } else {
- base.MergeFrom(other);
- return this;
- }
- }
-
- public override Builder MergeFrom(RouteSummary other) {
- if (other == global::examples.RouteSummary.DefaultInstance) return this;
- PrepareBuilder();
- if (other.HasPointCount) {
- PointCount = other.PointCount;
- }
- if (other.HasFeatureCount) {
- FeatureCount = other.FeatureCount;
- }
- if (other.HasDistance) {
- Distance = other.Distance;
- }
- if (other.HasElapsedTime) {
- ElapsedTime = other.ElapsedTime;
- }
- this.MergeUnknownFields(other.UnknownFields);
- return this;
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input) {
- return MergeFrom(input, pb::ExtensionRegistry.Empty);
- }
-
- public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
- PrepareBuilder();
- pb::UnknownFieldSet.Builder unknownFields = null;
- uint tag;
- string field_name;
- while (input.ReadTag(out tag, out field_name)) {
- if(tag == 0 && field_name != null) {
- int field_ordinal = global::System.Array.BinarySearch(_routeSummaryFieldNames, field_name, global::System.StringComparer.Ordinal);
- if(field_ordinal >= 0)
- tag = _routeSummaryFieldTags[field_ordinal];
- else {
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- continue;
- }
- }
- switch (tag) {
- case 0: {
- throw pb::InvalidProtocolBufferException.InvalidTag();
- }
- default: {
- if (pb::WireFormat.IsEndGroupTag(tag)) {
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
- if (unknownFields == null) {
- unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
- }
- ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
- break;
- }
- case 8: {
- result.hasPointCount = input.ReadInt32(ref result.pointCount_);
- break;
- }
- case 16: {
- result.hasFeatureCount = input.ReadInt32(ref result.featureCount_);
- break;
- }
- case 24: {
- result.hasDistance = input.ReadInt32(ref result.distance_);
- break;
- }
- case 32: {
- result.hasElapsedTime = input.ReadInt32(ref result.elapsedTime_);
- break;
- }
- }
- }
-
- if (unknownFields != null) {
- this.UnknownFields = unknownFields.Build();
- }
- return this;
- }
-
-
- public bool HasPointCount {
- get { return result.hasPointCount; }
- }
- public int PointCount {
- get { return result.PointCount; }
- set { SetPointCount(value); }
- }
- public Builder SetPointCount(int value) {
- PrepareBuilder();
- result.hasPointCount = true;
- result.pointCount_ = value;
- return this;
- }
- public Builder ClearPointCount() {
- PrepareBuilder();
- result.hasPointCount = false;
- result.pointCount_ = 0;
- return this;
- }
-
- public bool HasFeatureCount {
- get { return result.hasFeatureCount; }
- }
- public int FeatureCount {
- get { return result.FeatureCount; }
- set { SetFeatureCount(value); }
- }
- public Builder SetFeatureCount(int value) {
- PrepareBuilder();
- result.hasFeatureCount = true;
- result.featureCount_ = value;
- return this;
- }
- public Builder ClearFeatureCount() {
- PrepareBuilder();
- result.hasFeatureCount = false;
- result.featureCount_ = 0;
- return this;
- }
-
- public bool HasDistance {
- get { return result.hasDistance; }
- }
- public int Distance {
- get { return result.Distance; }
- set { SetDistance(value); }
- }
- public Builder SetDistance(int value) {
- PrepareBuilder();
- result.hasDistance = true;
- result.distance_ = value;
- return this;
- }
- public Builder ClearDistance() {
- PrepareBuilder();
- result.hasDistance = false;
- result.distance_ = 0;
- return this;
- }
-
- public bool HasElapsedTime {
- get { return result.hasElapsedTime; }
- }
- public int ElapsedTime {
- get { return result.ElapsedTime; }
- set { SetElapsedTime(value); }
- }
- public Builder SetElapsedTime(int value) {
- PrepareBuilder();
- result.hasElapsedTime = true;
- result.elapsedTime_ = value;
- return this;
- }
- public Builder ClearElapsedTime() {
- PrepareBuilder();
- result.hasElapsedTime = false;
- result.elapsedTime_ = 0;
- return this;
- }
- }
- static RouteSummary() {
- object.ReferenceEquals(global::examples.Proto.RouteGuide.Descriptor, null);
- }
- }
-
- #endregion
-
-}
-
-#endregion Designer generated code
diff --git a/csharp/route_guide/RouteGuide/RouteGuide.csproj b/csharp/route_guide/RouteGuide/RouteGuide.csproj
deleted file mode 100644
index 8358974..0000000
--- a/csharp/route_guide/RouteGuide/RouteGuide.csproj
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
-
- Debug
- AnyCPU
- {49954D9C-5F17-4662-96B2-73BE833DD81A}
- Library
- Properties
- RouteGuide
- RouteGuide
- v4.5
- 512
- 214cccda
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.dll
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.Serialization.dll
-
-
- False
- ..\packages\Grpc.Core.0.6.0\lib\net45\Grpc.Core.dll
-
-
- False
- ..\packages\Newtonsoft.Json.7.0.1-beta2\lib\net45\Newtonsoft.Json.dll
-
-
-
- False
- ..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
-
- ..\packages\Ix-Async.1.2.3\lib\net45\System.Interactive.Async.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuide/RouteGuideGrpc.cs b/csharp/route_guide/RouteGuide/RouteGuideGrpc.cs
deleted file mode 100644
index c4b3900..0000000
--- a/csharp/route_guide/RouteGuide/RouteGuideGrpc.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: route_guide.proto
-#region Designer generated code
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Grpc.Core;
-
-namespace examples {
- public static class RouteGuide
- {
- static readonly string __ServiceName = "examples.RouteGuide";
-
- static readonly Marshaller __Marshaller_Point = Marshallers.Create((arg) => arg.ToByteArray(), global::examples.Point.ParseFrom);
- static readonly Marshaller __Marshaller_Feature = Marshallers.Create((arg) => arg.ToByteArray(), global::examples.Feature.ParseFrom);
- static readonly Marshaller __Marshaller_Rectangle = Marshallers.Create((arg) => arg.ToByteArray(), global::examples.Rectangle.ParseFrom);
- static readonly Marshaller __Marshaller_RouteSummary = Marshallers.Create((arg) => arg.ToByteArray(), global::examples.RouteSummary.ParseFrom);
- static readonly Marshaller __Marshaller_RouteNote = Marshallers.Create((arg) => arg.ToByteArray(), global::examples.RouteNote.ParseFrom);
-
- static readonly Method __Method_GetFeature = new Method(
- MethodType.Unary,
- "GetFeature",
- __Marshaller_Point,
- __Marshaller_Feature);
-
- static readonly Method __Method_ListFeatures = new Method(
- MethodType.ServerStreaming,
- "ListFeatures",
- __Marshaller_Rectangle,
- __Marshaller_Feature);
-
- static readonly Method __Method_RecordRoute = new Method(
- MethodType.ClientStreaming,
- "RecordRoute",
- __Marshaller_Point,
- __Marshaller_RouteSummary);
-
- static readonly Method __Method_RouteChat = new Method(
- MethodType.DuplexStreaming,
- "RouteChat",
- __Marshaller_RouteNote,
- __Marshaller_RouteNote);
-
- // client-side stub interface
- public interface IRouteGuideClient
- {
- global::examples.Feature GetFeature(global::examples.Point request, CancellationToken token = default(CancellationToken));
- Task GetFeatureAsync(global::examples.Point request, CancellationToken token = default(CancellationToken));
- AsyncServerStreamingCall ListFeatures(global::examples.Rectangle request, CancellationToken token = default(CancellationToken));
- AsyncClientStreamingCall RecordRoute(CancellationToken token = default(CancellationToken));
- AsyncDuplexStreamingCall RouteChat(CancellationToken token = default(CancellationToken));
- }
-
- // server-side interface
- public interface IRouteGuide
- {
- Task GetFeature(ServerCallContext context, global::examples.Point request);
- Task ListFeatures(ServerCallContext context, global::examples.Rectangle request, IServerStreamWriter responseStream);
- Task RecordRoute(ServerCallContext context, IAsyncStreamReader requestStream);
- Task RouteChat(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream);
- }
-
- // client stub
- public class RouteGuideClient : AbstractStub, IRouteGuideClient
- {
- public RouteGuideClient(Channel channel) : this(channel, StubConfiguration.Default)
- {
- }
- public RouteGuideClient(Channel channel, StubConfiguration config) : base(channel, config)
- {
- }
- public global::examples.Feature GetFeature(global::examples.Point request, CancellationToken token = default(CancellationToken))
- {
- var call = CreateCall(__ServiceName, __Method_GetFeature);
- return Calls.BlockingUnaryCall(call, request, token);
- }
- public Task GetFeatureAsync(global::examples.Point request, CancellationToken token = default(CancellationToken))
- {
- var call = CreateCall(__ServiceName, __Method_GetFeature);
- return Calls.AsyncUnaryCall(call, request, token);
- }
- public AsyncServerStreamingCall ListFeatures(global::examples.Rectangle request, CancellationToken token = default(CancellationToken))
- {
- var call = CreateCall(__ServiceName, __Method_ListFeatures);
- return Calls.AsyncServerStreamingCall(call, request, token);
- }
- public AsyncClientStreamingCall RecordRoute(CancellationToken token = default(CancellationToken))
- {
- var call = CreateCall(__ServiceName, __Method_RecordRoute);
- return Calls.AsyncClientStreamingCall(call, token);
- }
- public AsyncDuplexStreamingCall RouteChat(CancellationToken token = default(CancellationToken))
- {
- var call = CreateCall(__ServiceName, __Method_RouteChat);
- return Calls.AsyncDuplexStreamingCall(call, token);
- }
- }
-
- // creates service definition that can be registered with a server
- public static ServerServiceDefinition BindService(IRouteGuide serviceImpl)
- {
- return ServerServiceDefinition.CreateBuilder(__ServiceName)
- .AddMethod(__Method_GetFeature, serviceImpl.GetFeature)
- .AddMethod(__Method_ListFeatures, serviceImpl.ListFeatures)
- .AddMethod(__Method_RecordRoute, serviceImpl.RecordRoute)
- .AddMethod(__Method_RouteChat, serviceImpl.RouteChat).Build();
- }
-
- // creates a new client stub
- public static IRouteGuideClient NewStub(Channel channel)
- {
- return new RouteGuideClient(channel);
- }
-
- // creates a new client stub
- public static IRouteGuideClient NewStub(Channel channel, StubConfiguration config)
- {
- return new RouteGuideClient(channel, config);
- }
- }
-}
-#endregion
diff --git a/csharp/route_guide/RouteGuide/RouteGuideUtil.cs b/csharp/route_guide/RouteGuide/RouteGuideUtil.cs
deleted file mode 100644
index 6fb8b1e..0000000
--- a/csharp/route_guide/RouteGuide/RouteGuideUtil.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace examples
-{
- public static class RouteGuideUtil
- {
- public const string DefaultFeaturesFile = "route_guide_db.json";
-
- private const double CoordFactor = 1e7;
-
- ///
- /// Indicates whether the given feature exists (i.e. has a valid name).
- ///
- public static bool Exists(Feature feature)
- {
- return feature != null && (feature.Name.Length != 0);
- }
-
- public static double GetLatitude(Point point)
- {
- return point.Latitude / CoordFactor;
- }
-
- public static double GetLongitude(Point point)
- {
- return point.Longitude / CoordFactor;
- }
-
- ///
- /// Parses features from a JSON file.
- ///
- public static List ParseFeatures(string filename)
- {
- var features = new List();
- var jsonFeatures = JsonConvert.DeserializeObject>(File.ReadAllText(filename));
-
-
- foreach(var jsonFeature in jsonFeatures)
- {
- features.Add(Feature.CreateBuilder().SetName(jsonFeature.name).SetLocation(
- Point.CreateBuilder()
- .SetLongitude(jsonFeature.location.longitude)
- .SetLatitude(jsonFeature.location.latitude).Build()).Build());
- }
- return features;
- }
-
- private class JsonFeature
- {
- public string name;
- public JsonLocation location;
- }
-
- private class JsonLocation
- {
- public int longitude;
- public int latitude;
- }
- }
-}
diff --git a/csharp/route_guide/RouteGuide/packages.config b/csharp/route_guide/RouteGuide/packages.config
deleted file mode 100644
index 79abe0a..0000000
--- a/csharp/route_guide/RouteGuide/packages.config
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuide/protos/route_guide.proto b/csharp/route_guide/RouteGuide/protos/route_guide.proto
deleted file mode 100644
index f4110b5..0000000
--- a/csharp/route_guide/RouteGuide/protos/route_guide.proto
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// TODO(jtattermusch): as of now, C# protobufs don't officially support
-// proto3.
-syntax = "proto2";
-
-package examples;
-
-// Interface exported by the server.
-service RouteGuide {
- // A simple RPC.
- //
- // Obtains the feature at a given position.
- //
- // A feature with an empty name is returned if there's no feature at the given
- // position.
- rpc GetFeature(Point) returns (Feature) {}
-
- // A server-to-client streaming RPC.
- //
- // Obtains the Features available within the given Rectangle. Results are
- // streamed rather than returned at once (e.g. in a response message with a
- // repeated field), as the rectangle may cover a large area and contain a
- // huge number of features.
- rpc ListFeatures(Rectangle) returns (stream Feature) {}
-
- // A client-to-server streaming RPC.
- //
- // Accepts a stream of Points on a route being traversed, returning a
- // RouteSummary when traversal is completed.
- rpc RecordRoute(stream Point) returns (RouteSummary) {}
-
- // A Bidirectional streaming RPC.
- //
- // Accepts a stream of RouteNotes sent while a route is being traversed,
- // while receiving other RouteNotes (e.g. from other users).
- rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
-}
-
-// Points are represented as latitude-longitude pairs in the E7 representation
-// (degrees multiplied by 10**7 and rounded to the nearest integer).
-// Latitudes should be in the range +/- 90 degrees and longitude should be in
-// the range +/- 180 degrees (inclusive).
-message Point {
- optional int32 latitude = 1;
- optional int32 longitude = 2;
-}
-
-// A latitude-longitude rectangle, represented as two diagonally opposite
-// points "lo" and "hi".
-message Rectangle {
- // One corner of the rectangle.
- optional Point lo = 1;
-
- // The other corner of the rectangle.
- optional Point hi = 2;
-}
-
-// A feature names something at a given point.
-//
-// If a feature could not be named, the name is empty.
-message Feature {
- // The name of the feature.
- optional string name = 1;
-
- // The point where the feature is detected.
- optional Point location = 2;
-}
-
-// A RouteNote is a message sent while at a given point.
-message RouteNote {
- // The location from which the message is sent.
- optional Point location = 1;
-
- // The message to be sent.
- optional string message = 2;
-}
-
-// A RouteSummary is received in response to a RecordRoute rpc.
-//
-// It contains the number of individual points received, the number of
-// detected features, and the total distance covered as the cumulative sum of
-// the distance between each point.
-message RouteSummary {
- // The number of points received.
- optional int32 point_count = 1;
-
- // The number of known features passed while traversing the route.
- optional int32 feature_count = 2;
-
- // The distance covered in metres.
- optional int32 distance = 3;
-
- // The duration of the traversal in seconds.
- optional int32 elapsed_time = 4;
-}
diff --git a/csharp/route_guide/RouteGuide/route_guide_db.json b/csharp/route_guide/RouteGuide/route_guide_db.json
deleted file mode 100644
index 209f016..0000000
--- a/csharp/route_guide/RouteGuide/route_guide_db.json
+++ /dev/null
@@ -1,601 +0,0 @@
-[{
- "location": {
- "latitude": 407838351,
- "longitude": -746143763
- },
- "name": "Patriots Path, Mendham, NJ 07945, USA"
-}, {
- "location": {
- "latitude": 408122808,
- "longitude": -743999179
- },
- "name": "101 New Jersey 10, Whippany, NJ 07981, USA"
-}, {
- "location": {
- "latitude": 413628156,
- "longitude": -749015468
- },
- "name": "U.S. 6, Shohola, PA 18458, USA"
-}, {
- "location": {
- "latitude": 419999544,
- "longitude": -740371136
- },
- "name": "5 Conners Road, Kingston, NY 12401, USA"
-}, {
- "location": {
- "latitude": 414008389,
- "longitude": -743951297
- },
- "name": "Mid Hudson Psychiatric Center, New Hampton, NY 10958, USA"
-}, {
- "location": {
- "latitude": 419611318,
- "longitude": -746524769
- },
- "name": "287 Flugertown Road, Livingston Manor, NY 12758, USA"
-}, {
- "location": {
- "latitude": 406109563,
- "longitude": -742186778
- },
- "name": "4001 Tremley Point Road, Linden, NJ 07036, USA"
-}, {
- "location": {
- "latitude": 416802456,
- "longitude": -742370183
- },
- "name": "352 South Mountain Road, Wallkill, NY 12589, USA"
-}, {
- "location": {
- "latitude": 412950425,
- "longitude": -741077389
- },
- "name": "Bailey Turn Road, Harriman, NY 10926, USA"
-}, {
- "location": {
- "latitude": 412144655,
- "longitude": -743949739
- },
- "name": "193-199 Wawayanda Road, Hewitt, NJ 07421, USA"
-}, {
- "location": {
- "latitude": 415736605,
- "longitude": -742847522
- },
- "name": "406-496 Ward Avenue, Pine Bush, NY 12566, USA"
-}, {
- "location": {
- "latitude": 413843930,
- "longitude": -740501726
- },
- "name": "162 Merrill Road, Highland Mills, NY 10930, USA"
-}, {
- "location": {
- "latitude": 410873075,
- "longitude": -744459023
- },
- "name": "Clinton Road, West Milford, NJ 07480, USA"
-}, {
- "location": {
- "latitude": 412346009,
- "longitude": -744026814
- },
- "name": "16 Old Brook Lane, Warwick, NY 10990, USA"
-}, {
- "location": {
- "latitude": 402948455,
- "longitude": -747903913
- },
- "name": "3 Drake Lane, Pennington, NJ 08534, USA"
-}, {
- "location": {
- "latitude": 406337092,
- "longitude": -740122226
- },
- "name": "6324 8th Avenue, Brooklyn, NY 11220, USA"
-}, {
- "location": {
- "latitude": 406421967,
- "longitude": -747727624
- },
- "name": "1 Merck Access Road, Whitehouse Station, NJ 08889, USA"
-}, {
- "location": {
- "latitude": 416318082,
- "longitude": -749677716
- },
- "name": "78-98 Schalck Road, Narrowsburg, NY 12764, USA"
-}, {
- "location": {
- "latitude": 415301720,
- "longitude": -748416257
- },
- "name": "282 Lakeview Drive Road, Highland Lake, NY 12743, USA"
-}, {
- "location": {
- "latitude": 402647019,
- "longitude": -747071791
- },
- "name": "330 Evelyn Avenue, Hamilton Township, NJ 08619, USA"
-}, {
- "location": {
- "latitude": 412567807,
- "longitude": -741058078
- },
- "name": "New York State Reference Route 987E, Southfields, NY 10975, USA"
-}, {
- "location": {
- "latitude": 416855156,
- "longitude": -744420597
- },
- "name": "103-271 Tempaloni Road, Ellenville, NY 12428, USA"
-}, {
- "location": {
- "latitude": 404663628,
- "longitude": -744820157
- },
- "name": "1300 Airport Road, North Brunswick Township, NJ 08902, USA"
-}, {
- "location": {
- "latitude": 407113723,
- "longitude": -749746483
- },
- "name": ""
-}, {
- "location": {
- "latitude": 402133926,
- "longitude": -743613249
- },
- "name": ""
-}, {
- "location": {
- "latitude": 400273442,
- "longitude": -741220915
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411236786,
- "longitude": -744070769
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411633782,
- "longitude": -746784970
- },
- "name": "211-225 Plains Road, Augusta, NJ 07822, USA"
-}, {
- "location": {
- "latitude": 415830701,
- "longitude": -742952812
- },
- "name": ""
-}, {
- "location": {
- "latitude": 413447164,
- "longitude": -748712898
- },
- "name": "165 Pedersen Ridge Road, Milford, PA 18337, USA"
-}, {
- "location": {
- "latitude": 405047245,
- "longitude": -749800722
- },
- "name": "100-122 Locktown Road, Frenchtown, NJ 08825, USA"
-}, {
- "location": {
- "latitude": 418858923,
- "longitude": -746156790
- },
- "name": ""
-}, {
- "location": {
- "latitude": 417951888,
- "longitude": -748484944
- },
- "name": "650-652 Willi Hill Road, Swan Lake, NY 12783, USA"
-}, {
- "location": {
- "latitude": 407033786,
- "longitude": -743977337
- },
- "name": "26 East 3rd Street, New Providence, NJ 07974, USA"
-}, {
- "location": {
- "latitude": 417548014,
- "longitude": -740075041
- },
- "name": ""
-}, {
- "location": {
- "latitude": 410395868,
- "longitude": -744972325
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404615353,
- "longitude": -745129803
- },
- "name": ""
-}, {
- "location": {
- "latitude": 406589790,
- "longitude": -743560121
- },
- "name": "611 Lawrence Avenue, Westfield, NJ 07090, USA"
-}, {
- "location": {
- "latitude": 414653148,
- "longitude": -740477477
- },
- "name": "18 Lannis Avenue, New Windsor, NY 12553, USA"
-}, {
- "location": {
- "latitude": 405957808,
- "longitude": -743255336
- },
- "name": "82-104 Amherst Avenue, Colonia, NJ 07067, USA"
-}, {
- "location": {
- "latitude": 411733589,
- "longitude": -741648093
- },
- "name": "170 Seven Lakes Drive, Sloatsburg, NY 10974, USA"
-}, {
- "location": {
- "latitude": 412676291,
- "longitude": -742606606
- },
- "name": "1270 Lakes Road, Monroe, NY 10950, USA"
-}, {
- "location": {
- "latitude": 409224445,
- "longitude": -748286738
- },
- "name": "509-535 Alphano Road, Great Meadows, NJ 07838, USA"
-}, {
- "location": {
- "latitude": 406523420,
- "longitude": -742135517
- },
- "name": "652 Garden Street, Elizabeth, NJ 07202, USA"
-}, {
- "location": {
- "latitude": 401827388,
- "longitude": -740294537
- },
- "name": "349 Sea Spray Court, Neptune City, NJ 07753, USA"
-}, {
- "location": {
- "latitude": 410564152,
- "longitude": -743685054
- },
- "name": "13-17 Stanley Street, West Milford, NJ 07480, USA"
-}, {
- "location": {
- "latitude": 408472324,
- "longitude": -740726046
- },
- "name": "47 Industrial Avenue, Teterboro, NJ 07608, USA"
-}, {
- "location": {
- "latitude": 412452168,
- "longitude": -740214052
- },
- "name": "5 White Oak Lane, Stony Point, NY 10980, USA"
-}, {
- "location": {
- "latitude": 409146138,
- "longitude": -746188906
- },
- "name": "Berkshire Valley Management Area Trail, Jefferson, NJ, USA"
-}, {
- "location": {
- "latitude": 404701380,
- "longitude": -744781745
- },
- "name": "1007 Jersey Avenue, New Brunswick, NJ 08901, USA"
-}, {
- "location": {
- "latitude": 409642566,
- "longitude": -746017679
- },
- "name": "6 East Emerald Isle Drive, Lake Hopatcong, NJ 07849, USA"
-}, {
- "location": {
- "latitude": 408031728,
- "longitude": -748645385
- },
- "name": "1358-1474 New Jersey 57, Port Murray, NJ 07865, USA"
-}, {
- "location": {
- "latitude": 413700272,
- "longitude": -742135189
- },
- "name": "367 Prospect Road, Chester, NY 10918, USA"
-}, {
- "location": {
- "latitude": 404310607,
- "longitude": -740282632
- },
- "name": "10 Simon Lake Drive, Atlantic Highlands, NJ 07716, USA"
-}, {
- "location": {
- "latitude": 409319800,
- "longitude": -746201391
- },
- "name": "11 Ward Street, Mount Arlington, NJ 07856, USA"
-}, {
- "location": {
- "latitude": 406685311,
- "longitude": -742108603
- },
- "name": "300-398 Jefferson Avenue, Elizabeth, NJ 07201, USA"
-}, {
- "location": {
- "latitude": 419018117,
- "longitude": -749142781
- },
- "name": "43 Dreher Road, Roscoe, NY 12776, USA"
-}, {
- "location": {
- "latitude": 412856162,
- "longitude": -745148837
- },
- "name": "Swan Street, Pine Island, NY 10969, USA"
-}, {
- "location": {
- "latitude": 416560744,
- "longitude": -746721964
- },
- "name": "66 Pleasantview Avenue, Monticello, NY 12701, USA"
-}, {
- "location": {
- "latitude": 405314270,
- "longitude": -749836354
- },
- "name": ""
-}, {
- "location": {
- "latitude": 414219548,
- "longitude": -743327440
- },
- "name": ""
-}, {
- "location": {
- "latitude": 415534177,
- "longitude": -742900616
- },
- "name": "565 Winding Hills Road, Montgomery, NY 12549, USA"
-}, {
- "location": {
- "latitude": 406898530,
- "longitude": -749127080
- },
- "name": "231 Rocky Run Road, Glen Gardner, NJ 08826, USA"
-}, {
- "location": {
- "latitude": 407586880,
- "longitude": -741670168
- },
- "name": "100 Mount Pleasant Avenue, Newark, NJ 07104, USA"
-}, {
- "location": {
- "latitude": 400106455,
- "longitude": -742870190
- },
- "name": "517-521 Huntington Drive, Manchester Township, NJ 08759, USA"
-}, {
- "location": {
- "latitude": 400066188,
- "longitude": -746793294
- },
- "name": ""
-}, {
- "location": {
- "latitude": 418803880,
- "longitude": -744102673
- },
- "name": "40 Mountain Road, Napanoch, NY 12458, USA"
-}, {
- "location": {
- "latitude": 414204288,
- "longitude": -747895140
- },
- "name": ""
-}, {
- "location": {
- "latitude": 414777405,
- "longitude": -740615601
- },
- "name": ""
-}, {
- "location": {
- "latitude": 415464475,
- "longitude": -747175374
- },
- "name": "48 North Road, Forestburgh, NY 12777, USA"
-}, {
- "location": {
- "latitude": 404062378,
- "longitude": -746376177
- },
- "name": ""
-}, {
- "location": {
- "latitude": 405688272,
- "longitude": -749285130
- },
- "name": ""
-}, {
- "location": {
- "latitude": 400342070,
- "longitude": -748788996
- },
- "name": ""
-}, {
- "location": {
- "latitude": 401809022,
- "longitude": -744157964
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404226644,
- "longitude": -740517141
- },
- "name": "9 Thompson Avenue, Leonardo, NJ 07737, USA"
-}, {
- "location": {
- "latitude": 410322033,
- "longitude": -747871659
- },
- "name": ""
-}, {
- "location": {
- "latitude": 407100674,
- "longitude": -747742727
- },
- "name": ""
-}, {
- "location": {
- "latitude": 418811433,
- "longitude": -741718005
- },
- "name": "213 Bush Road, Stone Ridge, NY 12484, USA"
-}, {
- "location": {
- "latitude": 415034302,
- "longitude": -743850945
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411349992,
- "longitude": -743694161
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404839914,
- "longitude": -744759616
- },
- "name": "1-17 Bergen Court, New Brunswick, NJ 08901, USA"
-}, {
- "location": {
- "latitude": 414638017,
- "longitude": -745957854
- },
- "name": "35 Oakland Valley Road, Cuddebackville, NY 12729, USA"
-}, {
- "location": {
- "latitude": 412127800,
- "longitude": -740173578
- },
- "name": ""
-}, {
- "location": {
- "latitude": 401263460,
- "longitude": -747964303
- },
- "name": ""
-}, {
- "location": {
- "latitude": 412843391,
- "longitude": -749086026
- },
- "name": ""
-}, {
- "location": {
- "latitude": 418512773,
- "longitude": -743067823
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404318328,
- "longitude": -740835638
- },
- "name": "42-102 Main Street, Belford, NJ 07718, USA"
-}, {
- "location": {
- "latitude": 419020746,
- "longitude": -741172328
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404080723,
- "longitude": -746119569
- },
- "name": ""
-}, {
- "location": {
- "latitude": 401012643,
- "longitude": -744035134
- },
- "name": ""
-}, {
- "location": {
- "latitude": 404306372,
- "longitude": -741079661
- },
- "name": ""
-}, {
- "location": {
- "latitude": 403966326,
- "longitude": -748519297
- },
- "name": ""
-}, {
- "location": {
- "latitude": 405002031,
- "longitude": -748407866
- },
- "name": ""
-}, {
- "location": {
- "latitude": 409532885,
- "longitude": -742200683
- },
- "name": ""
-}, {
- "location": {
- "latitude": 416851321,
- "longitude": -742674555
- },
- "name": ""
-}, {
- "location": {
- "latitude": 406411633,
- "longitude": -741722051
- },
- "name": "3387 Richmond Terrace, Staten Island, NY 10303, USA"
-}, {
- "location": {
- "latitude": 413069058,
- "longitude": -744597778
- },
- "name": "261 Van Sickle Road, Goshen, NY 10924, USA"
-}, {
- "location": {
- "latitude": 418465462,
- "longitude": -746859398
- },
- "name": ""
-}, {
- "location": {
- "latitude": 411733222,
- "longitude": -744228360
- },
- "name": ""
-}, {
- "location": {
- "latitude": 410248224,
- "longitude": -747127767
- },
- "name": "3 Hasta Way, Newton, NJ 07860, USA"
-}]
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuideClient/App.config b/csharp/route_guide/RouteGuideClient/App.config
deleted file mode 100644
index 8e15646..0000000
--- a/csharp/route_guide/RouteGuideClient/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuideClient/Program.cs b/csharp/route_guide/RouteGuideClient/Program.cs
deleted file mode 100644
index 0352c78..0000000
--- a/csharp/route_guide/RouteGuideClient/Program.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-using Grpc.Core;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace examples
-{
- class Program
- {
- ///
- /// Sample client code that makes gRPC calls to the server.
- ///
- public class RouteGuideClient
- {
- readonly RouteGuide.IRouteGuideClient client;
-
- public RouteGuideClient(RouteGuide.IRouteGuideClient client)
- {
- this.client = client;
- }
-
- ///
- /// Blocking unary call example. Calls GetFeature and prints the response.
- ///
- public void GetFeature(int lat, int lon)
- {
- try
- {
- Log("*** GetFeature: lat={0} lon={1}", lat, lon);
-
- Point request = Point.CreateBuilder().SetLatitude(lat).SetLongitude(lon).Build();
-
- Feature feature = client.GetFeature(request);
- if (RouteGuideUtil.Exists(feature))
- {
- Log("Found feature called \"{0}\" at {1}, {2}",
- feature.Name,
- RouteGuideUtil.GetLatitude(feature.Location),
- RouteGuideUtil.GetLongitude(feature.Location));
- }
- else
- {
- Log("Found no feature at {0}, {1}",
- RouteGuideUtil.GetLatitude(feature.Location),
- RouteGuideUtil.GetLongitude(feature.Location));
- }
- }
- catch (RpcException e)
- {
- Log("RPC failed " + e);
- throw e;
- }
- }
-
-
- ///
- /// Server-streaming example. Calls listFeatures with a rectangle of interest. Prints each response feature as it arrives.
- ///
- public async Task ListFeatures(int lowLat, int lowLon, int hiLat, int hiLon)
- {
- try
- {
- Log("*** ListFeatures: lowLat={0} lowLon={1} hiLat={2} hiLon={3}", lowLat, lowLon, hiLat,
- hiLon);
-
- Rectangle request =
- Rectangle.CreateBuilder()
- .SetLo(Point.CreateBuilder().SetLatitude(lowLat).SetLongitude(lowLon).Build())
- .SetHi(Point.CreateBuilder().SetLatitude(hiLat).SetLongitude(hiLon).Build()).Build();
-
- using (var call = client.ListFeatures(request))
- {
- StringBuilder responseLog = new StringBuilder("Result: ");
-
- while (await call.ResponseStream.MoveNext())
- {
- Feature feature = call.ResponseStream.Current;
- responseLog.Append(feature.ToString());
- }
- Log(responseLog.ToString());
- }
- }
- catch (RpcException e)
- {
- Log("RPC failed " + e);
- throw e;
- }
- }
-
- ///
- /// Client-streaming example. Sends numPoints randomly chosen points from features
- /// with a variable delay in between. Prints the statistics when they are sent from the server.
- ///
- public async Task RecordRoute(List features, int numPoints)
- {
- try
- {
- Log("*** RecordRoute");
- using (var call = client.RecordRoute())
- {
- // Send numPoints points randomly selected from the features list.
- StringBuilder numMsg = new StringBuilder();
- Random rand = new Random();
- for (int i = 0; i < numPoints; ++i)
- {
- int index = rand.Next(features.Count);
- Point point = features[index].Location;
- Log("Visiting point {0}, {1}", RouteGuideUtil.GetLatitude(point),
- RouteGuideUtil.GetLongitude(point));
-
- await call.RequestStream.WriteAsync(point);
-
- // A bit of delay before sending the next one.
- await Task.Delay(rand.Next(1000) + 500);
- }
- await call.RequestStream.CompleteAsync();
-
- RouteSummary summary = await call.Result;
- Log("Finished trip with {0} points. Passed {1} features. "
- + "Travelled {2} meters. It took {3} seconds.", summary.PointCount,
- summary.FeatureCount, summary.Distance, summary.ElapsedTime);
-
- Log("Finished RecordRoute");
- }
- }
- catch (RpcException e)
- {
- Log("RPC failed", e);
- throw e;
- }
- }
-
- ///
- /// Bi-directional streaming example. Send some chat messages, and print any
- /// chat messages that are sent from the server.
- ///
- public async Task RouteChat()
- {
- try
- {
- Log("*** RouteChat");
- var requests =
- new List { NewNote("First message", 0, 0), NewNote("Second message", 0, 1), NewNote("Third message", 1, 0), NewNote("Fourth message", 1, 1) };
-
- using (var call = client.RouteChat())
- {
- var responseReaderTask = Task.Run(async () =>
- {
- while (await call.ResponseStream.MoveNext())
- {
- var note = call.ResponseStream.Current;
- Log("Got message \"{0}\" at {1}, {2}", note.Message,
- note.Location.Latitude, note.Location.Longitude);
- }
- });
-
- foreach (RouteNote request in requests)
- {
- Log("Sending message \"{0}\" at {1}, {2}", request.Message,
- request.Location.Latitude, request.Location.Longitude);
-
- await call.RequestStream.WriteAsync(request);
- }
- await call.RequestStream.CompleteAsync();
- await responseReaderTask;
-
- Log("Finished RouteChat");
- }
- }
- catch (RpcException e)
- {
- Log("RPC failed", e);
- throw e;
- }
- }
-
- private void Log(string s, params object[] args)
- {
- Console.WriteLine(string.Format(s, args));
- }
-
- private void Log(string s)
- {
- Console.WriteLine(s);
- }
-
- private RouteNote NewNote(string message, int lat, int lon)
- {
- return RouteNote.CreateBuilder().SetMessage(message).SetLocation(
- Point.CreateBuilder().SetLatitude(lat).SetLongitude(lat).Build()).Build();
- }
- }
-
- static void Main(string[] args)
- {
- GrpcEnvironment.Initialize();
-
- using (Channel channel = new Channel("127.0.0.1:50052"))
- {
- var client = new RouteGuideClient(RouteGuide.NewStub(channel));
-
- // Looking for a valid feature
- client.GetFeature(409146138, -746188906);
-
- // Feature missing.
- client.GetFeature(0, 0);
-
- // Looking for features between 40, -75 and 42, -73.
- client.ListFeatures(400000000, -750000000, 420000000, -730000000).Wait();
-
- // Record a few randomly selected points from the features file.
- client.RecordRoute(RouteGuideUtil.ParseFeatures(RouteGuideUtil.DefaultFeaturesFile), 10).Wait();
-
- // Send and receive some notes.
- client.RouteChat().Wait();
- }
-
- GrpcEnvironment.Shutdown();
- }
- }
-}
diff --git a/csharp/route_guide/RouteGuideClient/Properties/AssemblyInfo.cs b/csharp/route_guide/RouteGuideClient/Properties/AssemblyInfo.cs
deleted file mode 100644
index a17e164..0000000
--- a/csharp/route_guide/RouteGuideClient/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("RouteGuideClient")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("RouteGuideClient")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("914644eb-47cd-4a37-9fba-5e62dd432333")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/csharp/route_guide/RouteGuideClient/RouteGuideClient.csproj b/csharp/route_guide/RouteGuideClient/RouteGuideClient.csproj
deleted file mode 100644
index 78034a9..0000000
--- a/csharp/route_guide/RouteGuideClient/RouteGuideClient.csproj
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- Debug
- AnyCPU
- {D47BE663-4DE3-4206-B7A8-EA3FA066DADC}
- Exe
- Properties
- RouteGuideClient
- RouteGuideClient
- v4.5
- 512
- 794416d0
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.dll
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.Serialization.dll
-
-
- False
- ..\packages\Grpc.Core.0.6.0\lib\net45\Grpc.Core.dll
-
-
-
- False
- ..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
-
- ..\packages\Ix-Async.1.2.3\lib\net45\System.Interactive.Async.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {49954d9c-5f17-4662-96b2-73be833dd81a}
- RouteGuide
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuideClient/packages.config b/csharp/route_guide/RouteGuideClient/packages.config
deleted file mode 100644
index 5922553..0000000
--- a/csharp/route_guide/RouteGuideClient/packages.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuideServer/App.config b/csharp/route_guide/RouteGuideServer/App.config
deleted file mode 100644
index 8e15646..0000000
--- a/csharp/route_guide/RouteGuideServer/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuideServer/Program.cs b/csharp/route_guide/RouteGuideServer/Program.cs
deleted file mode 100644
index e00b4d6..0000000
--- a/csharp/route_guide/RouteGuideServer/Program.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using Grpc.Core;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace examples
-{
- class Program
- {
- static void Main(string[] args)
- {
- var features = RouteGuideUtil.ParseFeatures(RouteGuideUtil.DefaultFeaturesFile);
- GrpcEnvironment.Initialize();
-
- Server server = new Server();
- server.AddServiceDefinition(RouteGuide.BindService(new RouteGuideImpl(features)));
- int port = server.AddListeningPort("localhost", 50052);
- server.Start();
-
- Console.WriteLine("RouteGuide server listening on port " + port);
- Console.WriteLine("Press any key to stop the server...");
- Console.ReadKey();
-
- server.ShutdownAsync().Wait();
- GrpcEnvironment.Shutdown();
- }
- }
-}
diff --git a/csharp/route_guide/RouteGuideServer/Properties/AssemblyInfo.cs b/csharp/route_guide/RouteGuideServer/Properties/AssemblyInfo.cs
deleted file mode 100644
index a161b1d..0000000
--- a/csharp/route_guide/RouteGuideServer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("RouteGuideServer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("RouteGuideServer")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("908bdeef-05cc-42bf-9498-c4c573df8925")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs b/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs
deleted file mode 100644
index 0bdf386..0000000
--- a/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace examples
-{
- ///
- /// Example implementation of RouteGuide server.
- ///
- public class RouteGuideImpl : RouteGuide.IRouteGuide
- {
- readonly List features;
- private readonly ConcurrentDictionary> routeNotes =
- new ConcurrentDictionary>();
-
- public RouteGuideImpl(List features)
- {
- this.features = features;
- }
-
- ///
- /// Gets the feature at the requested point. If no feature at that location
- /// exists, an unnammed feature is returned at the provided location.
- ///
- public Task GetFeature(Grpc.Core.ServerCallContext context, Point request)
- {
- return Task.FromResult(CheckFeature(request));
- }
-
- ///
- /// Gets all features contained within the given bounding rectangle.
- ///
- public async Task ListFeatures(Grpc.Core.ServerCallContext context, Rectangle request, Grpc.Core.IServerStreamWriter responseStream)
- {
- int left = Math.Min(request.Lo.Longitude, request.Hi.Longitude);
- int right = Math.Max(request.Lo.Longitude, request.Hi.Longitude);
- int top = Math.Max(request.Lo.Latitude, request.Hi.Latitude);
- int bottom = Math.Min(request.Lo.Latitude, request.Hi.Latitude);
-
- foreach (var feature in features)
- {
- if (!RouteGuideUtil.Exists(feature))
- {
- continue;
- }
-
- int lat = feature.Location.Latitude;
- int lon = feature.Location.Longitude;
- if (lon >= left && lon <= right && lat >= bottom && lat <= top)
- {
- await responseStream.WriteAsync(feature);
- }
- }
- }
-
- ///
- /// Gets a stream of points, and responds with statistics about the "trip": number of points,
- /// number of known features visited, total distance traveled, and total time spent.
- ///
- public async Task RecordRoute(Grpc.Core.ServerCallContext context, Grpc.Core.IAsyncStreamReader requestStream)
- {
- int pointCount = 0;
- int featureCount = 0;
- int distance = 0;
- Point previous = null;
- var stopwatch = new Stopwatch();
- stopwatch.Start();
-
- while (await requestStream.MoveNext())
- {
- var point = requestStream.Current;
- pointCount++;
- if (RouteGuideUtil.Exists(CheckFeature(point)))
- {
- featureCount++;
- }
- if (previous != null)
- {
- distance += (int) CalcDistance(previous, point);
- }
- previous = point;
- }
-
- stopwatch.Stop();
- return RouteSummary.CreateBuilder().SetPointCount(pointCount)
- .SetFeatureCount(featureCount).SetDistance(distance)
- .SetElapsedTime((int) (stopwatch.ElapsedMilliseconds / 1000)).Build();
- }
-
- ///
- /// Receives a stream of message/location pairs, and responds with a stream of all previous
- /// messages at each of those locations.
- ///
- public async Task RouteChat(Grpc.Core.ServerCallContext context, Grpc.Core.IAsyncStreamReader requestStream, Grpc.Core.IServerStreamWriter responseStream)
- {
- while (await requestStream.MoveNext())
- {
- var note = requestStream.Current;
- List notes = GetOrCreateNotes(note.Location);
-
- List prevNotes;
- lock (notes)
- {
- prevNotes = new List(notes);
- }
-
- foreach (var prevNote in prevNotes)
- {
- await responseStream.WriteAsync(prevNote);
- }
-
- lock (notes)
- {
- notes.Add(note);
- }
- }
- }
-
-
- ///
- /// Get the notes list for the given location. If missing, create it.
- ///
- private List GetOrCreateNotes(Point location)
- {
- List notes = new List();
- routeNotes.TryAdd(location, notes);
- return routeNotes[location];
- }
-
- ///
- /// Gets the feature at the given point.
- ///
- /// the location to check
- /// The feature object at the point Note that an empty name indicates no feature.
- private Feature CheckFeature(Point location)
- {
- foreach (var feature in features)
- {
- if (feature.Location.Latitude == location.Latitude
- && feature.Location.Longitude == location.Longitude)
- {
- return feature;
- }
- }
-
- // No feature was found, return an unnamed feature.
- return Feature.CreateBuilder().SetName("").SetLocation(location).Build();
- }
-
- ///
- /// Calculate the distance between two points using the "haversine" formula.
- /// This code was taken from http://www.movable-type.co.uk/scripts/latlong.html.
- ///
- /// the starting point
- /// the end point
- /// the distance between the points in meters
- private static double CalcDistance(Point start, Point end)
- {
- double lat1 = RouteGuideUtil.GetLatitude(start);
- double lat2 = RouteGuideUtil.GetLatitude(end);
- double lon1 = RouteGuideUtil.GetLongitude(start);
- double lon2 = RouteGuideUtil.GetLongitude(end);
- int r = 6371000; // metres
- double φ1 = ToRadians(lat1);
- double φ2 = ToRadians(lat2);
- double Δφ = ToRadians(lat2 - lat1);
- double Δλ = ToRadians(lon2 - lon1);
-
- double a = Math.Sin(Δφ / 2) * Math.Sin(Δφ / 2) + Math.Cos(φ1) * Math.Cos(φ2) * Math.Sin(Δλ / 2) * Math.Sin(Δλ / 2);
- double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
-
- return r * c;
- }
-
- private static double ToRadians(double val)
- {
- return (Math.PI / 180) * val;
- }
- }
-}
diff --git a/csharp/route_guide/RouteGuideServer/RouteGuideServer.csproj b/csharp/route_guide/RouteGuideServer/RouteGuideServer.csproj
deleted file mode 100644
index 9ac1cfb..0000000
--- a/csharp/route_guide/RouteGuideServer/RouteGuideServer.csproj
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
-
- Debug
- AnyCPU
- {4B7C7794-BE24-4477-ACE7-18259EB73D27}
- Exe
- Properties
- RouteGuideServer
- RouteGuideServer
- v4.5
- 512
- 74781d8b
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.dll
-
-
- ..\packages\Google.ProtocolBuffers.2.4.1.555\lib\net40\Google.ProtocolBuffers.Serialization.dll
-
-
- False
- ..\packages\Grpc.Core.0.6.0\lib\net45\Grpc.Core.dll
-
-
-
- False
- ..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
-
- ..\packages\Ix-Async.1.2.3\lib\net45\System.Interactive.Async.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {49954d9c-5f17-4662-96b2-73be833dd81a}
- RouteGuide
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/route_guide/RouteGuideServer/packages.config b/csharp/route_guide/RouteGuideServer/packages.config
deleted file mode 100644
index 5922553..0000000
--- a/csharp/route_guide/RouteGuideServer/packages.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/go/README.md b/go/README.md
deleted file mode 100644
index 79db479..0000000
--- a/go/README.md
+++ /dev/null
@@ -1,53 +0,0 @@
-gRPC in 3 minutes (Go)
-======================
-
-BACKGROUND
--------------
-For this sample, we've already generated the server and client stubs from [helloworld.proto](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto).
-
-PREREQUISITES
--------------
-
-- This requires Go 1.4
-- Requires that [GOPATH is set](https://golang.org/doc/code.html#GOPATH)
-```sh
-$ go help gopath
-$ # ensure the PATH contains $GOPATH/bin
-$ export PATH=$PATH:$GOPATH/bin
-```
-
-INSTALL
--------
-
-```sh
-$ go get -u github.com/grpc/grpc-common/go/greeter_client
-$ go get -u github.com/grpc/grpc-common/go/greeter_server
-```
-
-TRY IT!
--------
-
-- Run the server
-```sh
-$ greeter_server &
-```
-
-- Run the client
-```sh
-$ greeter_client
-```
-
-OPTIONAL - Rebuilding the generated code
-----------------------------------------
-
-1 First [install protoc](https://github.com/google/protobuf/blob/master/INSTALL.txt)
- - For now, this needs to be installed from source
- - This is will change once proto3 is officially released
-
-2 Install the protoc Go plugin.
-```sh
-$ go get -a github.com/golang/protobuf/protoc-gen-go
-$
-$ # from this dir; invoke protoc
-$ protoc -I ../protos ../protos/helloworld.proto --go_out=plugins=grpc:helloworld
-```
diff --git a/go/gotutorial.md b/go/gotutorial.md
deleted file mode 100644
index 63f0ad9..0000000
--- a/go/gotutorial.md
+++ /dev/null
@@ -1,431 +0,0 @@
-#gRPC Basics: Go
-
-This tutorial provides a basic Go programmer's introduction to working with gRPC. By walking through this example you'll learn how to:
-
-- Define a service in a .proto file.
-- Generate server and client code using the protocol buffer compiler.
-- Use the Go gRPC API to write a simple client and server for your service.
-
-It assumes that you have read the [Getting started](https://github.com/grpc/grpc-common) guide and are familiar with [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). Note that the example in this tutorial uses the proto3 version of the protocol buffers language, which is currently in alpha release:you can find out more in the [proto3 language guide](https://developers.google.com/protocol-buffers/docs/proto3) and see the [release notes](https://github.com/google/protobuf/releases) for the new version in the protocol buffers Github repository.
-
-This isn't a comprehensive guide to using gRPC in Go: more reference documentation is coming soon.
-
-## Why use gRPC?
-
-Our example is a simple route mapping application that lets clients get information about features on their route, create a summary of their route, and exchange route information such as traffic updates with the server and other clients.
-
-With gRPC we can define our service once in a .proto file and implement clients and servers in any of gRPC's supported languages, which in turn can be run in environments ranging from servers inside Google to your own tablet - all the complexity of communication between different languages and environments is handled for you by gRPC. We also get all the advantages of working with protocol buffers, including efficient serialization, a simple IDL, and easy interface updating.
-
-## Example code and setup
-
-The example code for our tutorial is in [grpc/grpc-go/examples/route_guide](https://github.com/grpc/grpc-go/tree/master/examples/route_guide). To download the example, clone the `grpc-go` repository by running the following command:
-```shell
-$ go get google.golang.org/grpc
-```
-
-Then change your current directory to `grpc-go/examples/route_guide`:
-```shell
-$ cd $GOPATH/src/google.golang.org/grpc/examples/route_guide
-```
-
-You also should have the relevant tools installed to generate the server and client interface code - if you don't already, follow the setup instructions in [the Go quick start guide](https://github.com/grpc/grpc-common/tree/master/go).
-
-
-## Defining the service
-
-Our first step (as you'll know from [Getting started](https://github.com/grpc/grpc-common)) is to define the gRPC *service* and the method *request* and *response* types using [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). You can see the complete .proto file in [`grpc-common/protos/route_guide.proto`](https://github.com/grpc/grpc-common/blob/master/protos/route_guide.proto).
-
-To define a service, you specify a named `service` in your .proto file:
-
-```proto
-service RouteGuide {
- ...
-}
-```
-
-Then you define `rpc` methods inside your service definition, specifying their request and response types. gRPC lets you define four kinds of service method, all of which are used in the `RouteGuide` service:
-
-- A *simple RPC* where the client sends a request to the server using the stub and waits for a response to come back, just like a normal function call.
-```proto
- // Obtains the feature at a given position.
- rpc GetFeature(Point) returns (Feature) {}
-```
-
-- A *server-side streaming RPC* where the client sends a request to the server and gets a stream to read a sequence of messages back. The client reads from the returned stream until there are no more messages. As you can see in our example, you specify a server-side streaming method by placing the `stream` keyword before the *response* type.
-```proto
- // Obtains the Features available within the given Rectangle. Results are
- // streamed rather than returned at once (e.g. in a response message with a
- // repeated field), as the rectangle may cover a large area and contain a
- // huge number of features.
- rpc ListFeatures(Rectangle) returns (stream Feature) {}
-```
-
-- A *client-side streaming RPC* where the client writes a sequence of messages and sends them to the server, again using a provided stream. Once the client has finished writing the messages, it waits for the server to read them all and return its response. You specify a client-side streaming method by placing the `stream` keyword before the *request* type.
-```proto
- // Accepts a stream of Points on a route being traversed, returning a
- // RouteSummary when traversal is completed.
- rpc RecordRoute(stream Point) returns (RouteSummary) {}
-```
-
-- A *bidirectional streaming RPC* where both sides send a sequence of messages using a read-write stream. The two streams operate independently, so clients and servers can read and write in whatever order they like: for example, the server could wait to receive all the client messages before writing its responses, or it could alternately read a message then write a message, or some other combination of reads and writes. The order of messages in each stream is preserved. You specify this type of method by placing the `stream` keyword before both the request and the response.
-```proto
- // Accepts a stream of RouteNotes sent while a route is being traversed,
- // while receiving other RouteNotes (e.g. from other users).
- rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
-```
-
-Our .proto file also contains protocol buffer message type definitions for all the request and response types used in our service methods - for example, here's the `Point` message type:
-```proto
-// Points are represented as latitude-longitude pairs in the E7 representation
-// (degrees multiplied by 10**7 and rounded to the nearest integer).
-// Latitudes should be in the range +/- 90 degrees and longitude should be in
-// the range +/- 180 degrees (inclusive).
-message Point {
- int32 latitude = 1;
- int32 longitude = 2;
-}
-```
-
-
-## Generating client and server code
-
-Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler `protoc` with a special gRPC Go plugin.
-
-For simplicity, we've provided a [bash script](https://github.com/grpc/grpc-go/blob/master/codegen.sh) that runs `protoc` for you with the appropriate plugin, input, and output (if you want to run this by yourself, make sure you've installed protoc and followed the gRPC-Go [installation instructions](https://github.com/grpc/grpc-go/blob/master/README.md) first):
-
-```shell
-$ codegen.sh route_guide.proto
-```
-
-which actually runs:
-
-```shell
-$ protoc --go_out=plugins=grpc:. route_guide.proto
-```
-
-Running this command generates the following file in your current directory:
-- `route_guide.pb.go`
-
-This contains:
-- All the protocol buffer code to populate, serialize, and retrieve our request and response message types
-- An interface type (or *stub*) for clients to call with the methods defined in the `RouteGuide` service.
-- An interface type for servers to implement, also with the methods defined in the `RouteGuide` service.
-
-
-
-## Creating the server
-
-First let's look at how we create a `RouteGuide` server. If you're only interested in creating gRPC clients, you can skip this section and go straight to [Creating the client](#client) (though you might find it interesting anyway!).
-
-There are two parts to making our `RouteGuide` service do its job:
-- Implementing the service interface generated from our service definition: doing the actual "work" of our service.
-- Running a gRPC server to listen for requests from clients and dispatch them to the right service implementation.
-
-You can find our example `RouteGuide` server in [grpc-go/examples/route_guide/server/server.go](https://github.com/grpc/grpc-go/tree/master/examples/route_guide/server/server.go). Let's take a closer look at how it works.
-
-### Implementing RouteGuide
-
-As you can see, our server has a `routeGuideServer` struct type that implements the generated `RouteGuideServer` interface:
-
-```go
-type routeGuideServer struct {
- ...
-}
-...
-
-func (s *routeGuideServer) GetFeature(ctx context.Context, point *pb.Point) (*pb.Feature, error) {
- ...
-}
-...
-
-func (s *routeGuideServer) ListFeatures(rect *pb.Rectangle, stream pb.RouteGuide_ListFeaturesServer) error {
- ...
-}
-...
-
-func (s *routeGuideServer) RecordRoute(stream pb.RouteGuide_RecordRouteServer) error {
- ...
-}
-...
-
-func (s *routeGuideServer) RouteChat(stream pb.RouteGuide_RouteChatServer) error {
- ...
-}
-...
-```
-
-#### Simple RPC
-`routeGuideServer` implements all our service methods. Let's look at the simplest type first, `GetFeature`, which just gets a `Point` from the client and returns the corresponding feature information from its database in a `Feature`.
-
-```go
-func (s *routeGuideServer) GetFeature(ctx context.Context, point *pb.Point) (*pb.Feature, error) {
- for _, feature := range s.savedFeatures {
- if proto.Equal(feature.Location, point) {
- return feature, nil
- }
- }
- // No feature was found, return an unnamed feature
- return &pb.Feature{"", point}, nil
-}
-```
-
-The method is passed a context object for the RPC and the client's `Point` protocol buffer request. It returns a `Feature` protocol buffer object with the response information and an `error`. In the method we populate the `Feature` with the appropriate information, and then `return` it along with an `nil` error to tell gRPC that we've finished dealing with the RPC and that the `Feature` can be returned to the client.
-
-#### Server-side streaming RPC
-Now let's look at one of our streaming RPCs. `ListFeatures` is a server-side streaming RPC, so we need to send back multiple `Feature`s to our client.
-
-```go
-func (s *routeGuideServer) ListFeatures(rect *pb.Rectangle, stream pb.RouteGuide_ListFeaturesServer) error {
- for _, feature := range s.savedFeatures {
- if inRange(feature.Location, rect) {
- if err := stream.Send(feature); err != nil {
- return err
- }
- }
- }
- return nil
-}
-```
-
-As you can see, instead of getting simple request and response objects in our method parameters, this time we get a request object (the `Rectangle` in which our client wants to find `Feature`s) and a special `RouteGuide_ListFeaturesServer` object to write our responses.
-
-In the method, we populate as many `Feature` objects as we need to return, writing them to the `RouteGuide_ListFeaturesServer` using its `Send()` method. Finally, as in our simple RPC, we return a `nil` error to tell gRPC that we've finished writing responses. Should any error happen in this call, we return a non-`nil` error; the gRPC layer will translate it into an appropriate RPC status to be sent on the wire.
-
-#### Client-side streaming RPC
-Now let's look at something a little more complicated: the client-side streaming method `RecordRoute`, where we get a stream of `Point`s from the client and return a single `RouteSummary` with information about their trip. As you can see, this time the method doesn't have a request parameter at all. Instead, it gets a `RouteGuide_RecordRouteServer` stream, which the server can use to both read *and* write messages - it can receive client messages using its `Recv()` method and return its single response using its `SendAndClose()` method.
-
-```go
-func (s *routeGuideServer) RecordRoute(stream pb.RouteGuide_RecordRouteServer) error {
- var pointCount, featureCount, distance int32
- var lastPoint *pb.Point
- startTime := time.Now()
- for {
- point, err := stream.Recv()
- if err == io.EOF {
- endTime := time.Now()
- return stream.SendAndClose(&pb.RouteSummary{
- PointCount: pointCount,
- FeatureCount: featureCount,
- Distance: distance,
- ElapsedTime: int32(endTime.Sub(startTime).Seconds()),
- })
- }
- if err != nil {
- return err
- }
- pointCount++
- for _, feature := range s.savedFeatures {
- if proto.Equal(feature.Location, point) {
- featureCount++
- }
- }
- if lastPoint != nil {
- distance += calcDistance(lastPoint, point)
- }
- lastPoint = point
- }
-}
-```
-
-In the method body we use the `RouteGuide_RecordRouteServer`s `Recv()` method to repeatedly read in our client's requests to a request object (in this case a `Point`) until there are no more messages: the server needs to check the the error returned from `Read()` after each call. If this is `nil`, the stream is still good and it can continue reading; if it's `io.EOF` the message stream has ended and the server can return its `RouteSummary`. If it has any other value, we return the error "as is" so that it'll be translated to an RPC status by the gRPC layer.
-
-#### Bidirectional streaming RPC
-Finally, let's look at our bidirectional streaming RPC `RouteChat()`.
-
-```go
-func (s *routeGuideServer) RouteChat(stream pb.RouteGuide_RouteChatServer) error {
- for {
- in, err := stream.Recv()
- if err == io.EOF {
- return nil
- }
- if err != nil {
- return err
- }
- key := serialize(in.Location)
- ... // look for notes to be sent to client
- for _, note := range s.routeNotes[key] {
- if err := stream.Send(note); err != nil {
- return err
- }
- }
- }
-}
-```
-
-This time we get a `RouteGuide_RouteChatServer` stream that, as in our client-side streaming example, can be used to read and write messages. However, this time we return values via our method's stream while the client is still writing messages to *their* message stream.
-
-The syntax for reading and writing here is very similar to our client-streaming method, except the server uses the stream's `Send()` method rather than `SendAndClose()` because it's writing multiple responses. Although each side will always get the other's messages in the order they were written, both the client and server can read and write in any order — the streams operate completely independently.
-
-### Starting the server
-
-Once we've implemented all our methods, we also need to start up a gRPC server so that clients can actually use our service. The following snippet shows how we do this for our `RouteGuide` service:
-
-```go
-flag.Parse()
-lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
-if err != nil {
- log.Fatalf("failed to listen: %v", err)
-}
-grpcServer := grpc.NewServer()
-pb.RegisterRouteGuideServer(grpcServer, &routeGuideServer{})
-... // determine whether to use TLS
-grpcServer.Serve(lis)
-```
-To build and start a server, we:
-
-1. Specify the port we want to use to listen for client requests using `lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))`.
-2. Create an instance of the gRPC server using `grpc.NewServer()`.
-3. Register our service implementation with the gRPC server.
-4. Call `Serve()` on the server with our port details to do a blocking wait until the process is killed or `Stop()` is called.
-
-
-## Creating the client
-
-In this section, we'll look at creating a Go client for our `RouteGuide` service. You can see our complete example client code in [grpc-go/examples/route_guide/client/client.go](https://github.com/grpc/grpc-go/tree/master/examples/route_guide/client/client.go).
-
-### Creating a stub
-
-To call service methods, we first need to create a gRPC *channel* to communicate with the server. We create this by passing the server address and port number to `grpc.Dial()` as follows:
-
-```go
-conn, err := grpc.Dial(*serverAddr)
-if err != nil {
- ...
-}
-defer conn.Close()
-```
-
-You can use `DialOptions` to set the auth credentials (e.g., TLS, GCE credentials, JWT credentials) in `grpc.Dial` if the service you request requires that - however, we don't need to do this for our `RouteGuide` service.
-
-Once the gRPC *channel* is setup, we need a client *stub* to perform RPCs. We get this using the `NewRouteGuideClient` method provided in the `pb` package we generated from our .proto.
-
-```go
-client := pb.NewRouteGuideClient(conn)
-```
-
-### Calling service methods
-
-Now let's look at how we call our service methods. Note that in gRPC-Go, RPCs operate in a blocking/synchronous mode, which means that the RPC call waits for the server to respond, and will either return a response or an error.
-
-#### Simple RPC
-
-Calling the simple RPC `GetFeature` is nearly as straightforward as calling a local method.
-
-```go
-feature, err := client.GetFeature(context.Background(), &pb.Point{409146138, -746188906})
-if err != nil {
- ...
-}
-```
-
-As you can see, we call the method on the stub we got earlier. In our method parameters we create and populate a request protocol buffer object (in our case `Point`). We also pass a `context.Context` object which lets us change our RPC's behaviour if necessary, such as time-out/cancel an RPC in flight. If the call doesn't return an error, then we can read the response information from the server from the first return value.
-
-```go
-log.Println(feature)
-```
-
-#### Server-side streaming RPC
-
-Here's where we call the server-side streaming method `ListFeatures`, which returns a stream of geographical `Feature`s. If you've already read [Creating the server](#server) some of this may look very familiar - streaming RPCs are implemented in a similar way on both sides.
-
-```go
-rect := &pb.Rectangle{ ... } // initialize a pb.Rectangle
-stream, err := client.ListFeatures(context.Background(), rect)
-if err != nil {
- ...
-}
-for {
- feature, err := stream.Recv()
- if err == io.EOF {
- break
- }
- if err != nil {
- log.Fatalf("%v.ListFeatures(_) = _, %v", client, err)
- }
- log.Println(feature)
-}
-```
-
-As in the simple RPC, we pass the method a context and a request. However, instead of getting a response object back, we get back an instance of `RouteGuide_ListFeaturesClient`. The client can use the `RouteGuide_ListFeaturesClient` stream to read the server's responses.
-
-We use the `RouteGuide_ListFeaturesClient`'s `Recv()` method to repeatedly read in the server's responses to a response protocol buffer object (in this case a `Feature`) until there are no more messages: the client needs to check the error `err` returned from `Recv()` after each call. If `nil`, the stream is still good and it can continue reading; if it's `io.EOF` then the message stream has ended; otherwise there must be an RPC error, which is passed over through `err`.
-
-#### Client-side streaming RPC
-
-The client-side streaming method `RecordRoute` is similar to the server-side method, except that we only pass the method a context and get a `RouteGuide_RecordRouteClient` stream back, which we can use to both write *and* read messages.
-
-```go
-// Create a random number of random points
-r := rand.New(rand.NewSource(time.Now().UnixNano()))
-pointCount := int(r.Int31n(100)) + 2 // Traverse at least two points
-var points []*pb.Point
-for i := 0; i < pointCount; i++ {
- points = append(points, randomPoint(r))
-}
-log.Printf("Traversing %d points.", len(points))
-stream, err := client.RecordRoute(context.Background())
-if err != nil {
- log.Fatalf("%v.RecordRoute(_) = _, %v", client, err)
-}
-for _, point := range points {
- if err := stream.Send(point); err != nil {
- log.Fatalf("%v.Send(%v) = %v", stream, point, err)
- }
-}
-reply, err := stream.CloseAndRecv()
-if err != nil {
- log.Fatalf("%v.CloseAndRecv() got error %v, want %v", stream, err, nil)
-}
-log.Printf("Route summary: %v", reply)
-```
-
-The `RouteGuide_RecordRouteClient` has a `Send()` method that we can use to send requests to the server. Once we've finished writing our client's requests to the stream using `Send()`, we need to call `CloseAndRecv()` on the stream to let gRPC know that we've finished writing and are expecting to receive a response. We get our RPC status from the `err` returned from `CloseAndRecv()`. If the status is `nil`, then the first return value from `CloseAndRecv()` will be a valid server response.
-
-#### Bidirectional streaming RPC
-
-Finally, let's look at our bidirectional streaming RPC `RouteChat()`. As in the case of `RecordRoute`, we only pass the method a context object and get back a stream that we can use to both write and read messages. However, this time we return values via our method's stream while the server is still writing messages to *their* message stream.
-
-```go
-stream, err := client.RouteChat(context.Background())
-waitc := make(chan struct{})
-go func() {
- for {
- in, err := stream.Recv()
- if err == io.EOF {
- // read done.
- close(waitc)
- return
- }
- if err != nil {
- log.Fatalf("Failed to receive a note : %v", err)
- }
- log.Printf("Got message %s at point(%d, %d)", in.Message, in.Location.Latitude, in.Location.Longitude)
- }
-}()
-for _, note := range notes {
- if err := stream.Send(note); err != nil {
- log.Fatalf("Failed to send a note: %v", err)
- }
-}
-stream.CloseSend()
-<-waitc
-```
-
-The syntax for reading and writing here is very similar to our client-side streaming method, except we use the stream's `CloseSend()` method once we've finished our call. Although each side will always get the other's messages in the order they were written, both the client and server can read and write in any order — the streams operate completely independently.
-
-## Try it out!
-
-To compile and run the server, assuming you are in the folder
-`$GOPATH/src/google.golang.org/grpc/examples/route_guide`, simply:
-
-```sh
-$ go run server/server.go
-```
-
-Likewise, to run the client:
-
-```sh
-$ go run client/client.go
-```
-
diff --git a/go/greeter_client/main.go b/go/greeter_client/main.go
deleted file mode 100644
index 065ae85..0000000
--- a/go/greeter_client/main.go
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package main
-
-import (
- "log"
- "os"
-
- pb "github.com/grpc/grpc-common/go/helloworld"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-const (
- address = "localhost:50051"
- defaultName = "world"
-)
-
-func main() {
- // Set up a connection to the server.
- conn, err := grpc.Dial(address)
- if err != nil {
- log.Fatalf("did not connect: %v", err)
- }
- defer conn.Close()
- c := pb.NewGreeterClient(conn)
-
- // Contact the server and print out its response.
- name := defaultName
- if len(os.Args) > 1 {
- name = os.Args[1]
- }
- r, err := c.SayHello(context.Background(), &pb.HelloRequest{Name: name})
- if err != nil {
- log.Fatalf("could not greet: %v", err)
- }
- log.Printf("Greeting: %s", r.Message)
-}
diff --git a/go/greeter_server/main.go b/go/greeter_server/main.go
deleted file mode 100644
index c7fa06a..0000000
--- a/go/greeter_server/main.go
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package main
-
-import (
- "log"
- "net"
-
- pb "github.com/grpc/grpc-common/go/helloworld"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-const (
- port = ":50051"
-)
-
-// server is used to implement hellowrld.GreeterServer.
-type server struct{}
-
-// SayHello implements helloworld.GreeterServer
-func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
- return &pb.HelloReply{Message: "Hello " + in.Name}, nil
-}
-
-func main() {
- lis, err := net.Listen("tcp", port)
- if err != nil {
- log.Fatalf("failed to listen: %v", err)
- }
- s := grpc.NewServer()
- pb.RegisterGreeterServer(s, &server{})
- s.Serve(lis)
-}
diff --git a/go/helloworld/helloworld.pb.go b/go/helloworld/helloworld.pb.go
deleted file mode 100644
index 1ff931a..0000000
--- a/go/helloworld/helloworld.pb.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Code generated by protoc-gen-go.
-// source: helloworld.proto
-// DO NOT EDIT!
-
-/*
-Package helloworld is a generated protocol buffer package.
-
-It is generated from these files:
- helloworld.proto
-
-It has these top-level messages:
- HelloRequest
- HelloReply
-*/
-package helloworld
-
-import proto "github.com/golang/protobuf/proto"
-
-import (
- context "golang.org/x/net/context"
- grpc "google.golang.org/grpc"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConn
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-
-// The request message containing the user's name.
-type HelloRequest struct {
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
-}
-
-func (m *HelloRequest) Reset() { *m = HelloRequest{} }
-func (m *HelloRequest) String() string { return proto.CompactTextString(m) }
-func (*HelloRequest) ProtoMessage() {}
-
-// The response message containing the greetings
-type HelloReply struct {
- Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
-}
-
-func (m *HelloReply) Reset() { *m = HelloReply{} }
-func (m *HelloReply) String() string { return proto.CompactTextString(m) }
-func (*HelloReply) ProtoMessage() {}
-
-func init() {
-}
-
-// Client API for Greeter service
-
-type GreeterClient interface {
- // Sends a greeting
- SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
-}
-
-type greeterClient struct {
- cc *grpc.ClientConn
-}
-
-func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
- return &greeterClient{cc}
-}
-
-func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
- out := new(HelloReply)
- err := grpc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// Server API for Greeter service
-
-type GreeterServer interface {
- // Sends a greeting
- SayHello(context.Context, *HelloRequest) (*HelloReply, error)
-}
-
-func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
- s.RegisterService(&_Greeter_serviceDesc, srv)
-}
-
-func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
- in := new(HelloRequest)
- if err := codec.Unmarshal(buf, in); err != nil {
- return nil, err
- }
- out, err := srv.(GreeterServer).SayHello(ctx, in)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-var _Greeter_serviceDesc = grpc.ServiceDesc{
- ServiceName: "helloworld.Greeter",
- HandlerType: (*GreeterServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "SayHello",
- Handler: _Greeter_SayHello_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
-}
diff --git a/grpc-auth-support.md b/grpc-auth-support.md
deleted file mode 100644
index b9ef299..0000000
--- a/grpc-auth-support.md
+++ /dev/null
@@ -1,289 +0,0 @@
-#gRPC Authentication support
-
-gRPC is designed to plug-in a number of authentication mechanisms. This document
-provides a quick overview of the various auth mechanisms supported, discusses
-the API with some examples, and concludes with a discussion of extensibility.
-More documentation and examples are coming soon!
-
-## Supported auth mechanisms
-
-###SSL/TLS
-gRPC has SSL/TLS integration and promotes the use of SSL/TLS to authenticate the
-server, and encrypt all the data exchanged between the client and the server.
-Optional mechanisms are available for clients to provide certificates to
-accomplish mutual authentication.
-
-###OAuth 2.0
-gRPC provides a generic mechanism (described below) to attach metadata to
-requests and responses. This mechanism can be used to attach OAuth 2.0 Access
-Tokens to RPCs being made at a client. Additional support for acquiring Access
-Tokens while accessing Google APIs through gRPC is provided for certain auth
-flows, demonstrated through code examples below.
-
-## API
-To reduce complexity and minimize API clutter, gRPC works with a unified concept
-of a Credentials object. Users construct gRPC credentials using corresponding
-bootstrap credentials (e.g., SSL client certs or Service Account Keys), and use
-the credentials while creating a gRPC channel to any server. Depending on the
-type of credential supplied, the channel uses the credentials during the initial
-SSL/TLS handshake with the server, or uses the credential to generate and
-attach Access Tokens to each request being made on the channel.
-
-###SSL/TLS for server authentication and encryption
-This is the simplest authentication scenario, where a client just wants to
-authenticate the server and encrypt all data.
-
-```cpp
-SslCredentialsOptions ssl_opts; // Options to override SSL params, empty by default
-// Create the credentials object by providing service account key in constructor
-std::unique_ptr creds = CredentialsFactory::SslCredentials(ssl_opts);
-// Create a channel using the credentials created in the previous step
-std::shared_ptr channel = CreateChannel(server_name, creds, channel_args);
-// Create a stub on the channel
-std::unique_ptr stub(Greeter::NewStub(channel));
-// Make actual RPC calls on the stub.
-grpc::Status s = stub->sayHello(&context, *request, response);
-```
-
-For advanced use cases such as modifying the root CA or using client certs,
-the corresponding options can be set in the SslCredentialsOptions parameter
-passed to the factory method.
-
-
-###Authenticating with Google
-
-gRPC applications can use a simple API to create a credential that works in various deployment scenarios.
-
-```cpp
-std::unique_ptr creds = CredentialsFactory::GoogleDefaultCredentials();
-// Create a channel, stub and make RPC calls (same as in the previous example)
-std::shared_ptr channel = CreateChannel(server_name, creds, channel_args);
-std::unique_ptr stub(Greeter::NewStub(channel));
-grpc::Status s = stub->sayHello(&context, *request, response);
-```
-
-This credential works for applications using Service Accounts as well as for
-applications running in [Google Compute Engine (GCE)](https://cloud.google.com/compute/). In the former case, the
-service account’s private keys are loaded from the file named in the environment
-variable `GOOGLE_APPLICATION_CREDENTIALS`. The
-keys are used to generate bearer tokens that are attached to each outgoing RPC
-on the corresponding channel.
-
-For applications running in GCE, a default service account and corresponding
-OAuth scopes can be configured during VM setup. At run-time, this credential
-handles communication with the authentication systems to obtain OAuth2 access
-tokens and attaches them to each outgoing RPC on the corresponding channel.
-Extending gRPC to support other authentication mechanisms
-The gRPC protocol is designed with a general mechanism for sending metadata
-associated with RPC. Clients can send metadata at the beginning of an RPC and
-servers can send back metadata at the beginning and end of the RPC. This
-provides a natural mechanism to support OAuth2 and other authentication
-mechanisms that need attach bearer tokens to individual request.
-
-In the simplest case, there is a single line of code required on the client
-to add a specific token as metadata to an RPC and a corresponding access on
-the server to retrieve this piece of metadata. The generation of the token
-on the client side and its verification at the server can be done separately.
-
-A deeper integration can be achieved by plugging in a gRPC credentials implementation for any custom authentication mechanism that needs to attach per-request tokens. gRPC internals also allow switching out SSL/TLS with other encryption mechanisms.
-
-## Examples
-
-These authentication mechanisms will be available in all gRPC's supported languages.
-The following sections demonstrate how authentication and authorization features described above appear in each language: more languages are coming soon.
-
-###SSL/TLS for server authentication and encryption (Ruby)
-```ruby
-# Base case - No encryption
-stub = Helloworld::Greeter::Stub.new('localhost:50051')
-...
-
-# With server authentication SSL/TLS
-creds = GRPC::Core::Credentials.new(load_certs) # load_certs typically loads a CA roots file
-stub = Helloworld::Greeter::Stub.new('localhost:50051', creds: creds)
-```
-
-###SSL/TLS for server authentication and encryption (C#)
-```csharp
-// Base case - No encryption
-var channel = new Channel("localhost:50051");
-var client = new Greeter.GreeterClient(channel);
-...
-
-// With server authentication SSL/TLS
-var credentials = new SslCredentials(File.ReadAllText("ca.pem")); // Load a CA file
-var channel = new Channel("localhost:50051", credentials);
-var client = new Greeter.GreeterClient(channel);
-```
-
-###SSL/TLS for server authentication and encryption (Objective-C)
-
-The default for Objective-C is to use SSL/TLS, as that's the most common use case when accessing
-remote APIs.
-
-```objective-c
-// Base case - With server authentication SSL/TLS
-HLWGreeter *client = [[HLWGreeter alloc] initWithHost:@"localhost:50051"];
-// Same as using @"https://localhost:50051".
-...
-
-// No encryption
-HLWGreeter *client = [[HLWGreeter alloc] initWithHost:@"http://localhost:50051"];
-// Specifying the HTTP scheme explicitly forces no encryption.
-```
-
-###SSL/TLS for server authentication and encryption (Python)
-```python
-# Base case - No encryption
-stub = early_adopter_create_GreeterService_stub('localhost', 50051)
-...
-
-# With server authentication SSL/TLS
-stub = early_adopter_create_GreeterService_stub(
- 'localhost', 50051, secure=True, root_certificates=open('ca.pem').read())
-...
-```
-n.b.: the beta API will look different
-
-###Authenticating with Google (Ruby)
-```ruby
-# Base case - No encryption/authorization
-stub = Helloworld::Greeter::Stub.new('localhost:50051')
-...
-
-# Authenticating with Google
-require 'googleauth' # from http://www.rubydoc.info/gems/googleauth/0.1.0
-...
-creds = GRPC::Core::Credentials.new(load_certs) # load_certs typically loads a CA roots file
-scope = 'https://www.googleapis.com/auth/grpc-testing'
-authorization = Google::Auth.get_application_default(scope)
-stub = Helloworld::Greeter::Stub.new('localhost:50051',
- creds: creds,
- update_metadata: authorization.updater_proc)
-```
-
-###Authenticating with Google (Node.js)
-
-```node
-// Base case - No encryption/authorization
-var stub = new helloworld.Greeter('localhost:50051');
-...
-// Authenticating with Google
-var GoogleAuth = require('google-auth-library'); // from https://www.npmjs.com/package/google-auth-library
-...
-var creds = grpc.Credentials.createSsl(load_certs); // load_certs typically loads a CA roots file
-var scope = 'https://www.googleapis.com/auth/grpc-testing';
-(new GoogleAuth()).getApplicationDefault(function(err, auth) {
- if (auth.createScopeRequired()) {
- auth = auth.createScoped(scope);
- }
- var stub = new helloworld.Greeter('localhost:50051',
- {credentials: creds},
- grpc.getGoogleAuthDelegate(auth));
-});
-```
-
-###Authenticating with Google (C#)
-```csharp
-// Base case - No encryption/authorization
-var channel = new Channel("localhost:50051");
-var client = new Greeter.GreeterClient(channel);
-...
-
-// Authenticating with Google
-using Grpc.Auth; // from Grpc.Auth NuGet package
-...
-var credentials = new SslCredentials(File.ReadAllText("ca.pem")); // Load a CA file
-var channel = new Channel("localhost:50051", credentials);
-
-string scope = "https://www.googleapis.com/auth/grpc-testing";
-var authorization = GoogleCredential.GetApplicationDefault();
-if (authorization.IsCreateScopedRequired)
-{
- authorization = credential.CreateScoped(new[] { scope });
-}
-var client = new Greeter.GreeterClient(channel,
- new StubConfiguration(OAuth2InterceptorFactory.Create(credential)));
-```
-
-###Authenticating with Google (PHP)
-```php
-// Base case - No encryption/authorization
-$client = new helloworld\GreeterClient(
- new Grpc\BaseStub('localhost:50051', []));
-...
-
-// Authenticating with Google
-// the environment variable "GOOGLE_APPLICATION_CREDENTIALS" needs to be set
-$scope = "https://www.googleapis.com/auth/grpc-testing";
-$auth = Google\Auth\ApplicationDefaultCredentials::getCredentials($scope);
-$opts = [
- 'credentials' => Grpc\Credentials::createSsl(file_get_contents('ca.pem'));
- 'update_metadata' => $auth->getUpdateMetadataFunc(),
-];
-
-$client = new helloworld\GreeterClient(
- new Grpc\BaseStub('localhost:50051', $opts));
-
-```
-
-###Authenticating with Google (Objective-C)
-
-This example uses the [Google iOS Sign-In library](https://developers.google.com/identity/sign-in/ios/),
-but it's easily extrapolated to any other OAuth2 library.
-
-```objective-c
-// Base case - No authentication
-[client sayHelloWithRequest:request handler:^(HLWHelloReply *response, NSError *error) {
- ...
-}];
-
-...
-
-// Authenticating with Google
-
-// When signing the user in, ask her for the relevant scopes.
-GIDSignIn.sharedInstance.scopes = @[@"https://www.googleapis.com/auth/grpc-testing"];
-
-...
-
-#import
-
-// Create a not-yet-started RPC. We want to set the request headers on this object before starting
-// it.
-ProtoRPC *call =
- [client RPCToSayHelloWithRequest:request handler:^(HLWHelloReply *response, NSError *error) {
- ...
- }];
-
-// Set the access token to be used.
-NSString *accessToken = GIDSignIn.sharedInstance.currentUser.authentication.accessToken;
-call.requestMetadata[@"Authorization"] = [@"Bearer " stringByAppendingString:accessToken]}];
-
-// Start the RPC.
-[call start];
-```
-
-You can see a working example app, with a more detailed explanation, [here](https://github.com/grpc/grpc-common/tree/master/objective-c/auth_sample).
-
-### Authenticating with Google (Python)
-```python
-# Base case - No encryption
-stub = early_adopter_create_GreeterService_stub('localhost', 50051)
-...
-
-# With server authentication SSL/TLS
-import oauth2client.client
-credentials = oauth2client.GoogleCredentials.get_application_default()
-scope = 'https://www.googleapis.com/auth/grpc-testing'
-scoped_credentials = credentials.create_scoped([scope])
-access_token = scoped_credentials.get_access_token().access_token
-metadata_transformer = (
- lambda x: [('Authorization', 'Bearer {}'.format(access_token))])
-
-stub = early_adopter_create_GreeterService_stub(
- 'localhost', 50051, secure=True, root_certificates=open('ca.pem').read(),
- metadata_transformer=metadata_transformer)
-...
-```
-n.b.: the beta API will look different
diff --git a/java/android/.gitignore b/java/android/.gitignore
deleted file mode 100644
index 6345b76..0000000
--- a/java/android/.gitignore
+++ /dev/null
@@ -1,21 +0,0 @@
-.gradle
-/local.properties
-/gradle.properties
-/.idea/workspace.xml
-/.idea/libraries
-.DS_Store
-/build
-.idea/
-
-*.iml
-*.apk
-*.ap_
-*.dex
-*.class
-bin/
-gen/
-.gradle/
-/*/build/
-local.properties
-proguard/
-*.log
diff --git a/java/android/README.md b/java/android/README.md
deleted file mode 100644
index 9de65a0..0000000
--- a/java/android/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-gRPC Hello World Tutorial (Android Java)
-========================
-
-BACKGROUND
--------------
-For this sample, we've already generated the server and client stubs from [helloworld.proto](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto).
-
-PREREQUISITES
--------------
-- [Java gRPC](https://github.com/grpc/grpc-java)
-
-- [Android Tutorial](https://developer.android.com/training/basics/firstapp/index.html) if you're new to Android development
-
-- We only have Android gRPC client in this example. Please follow examples in other languages to build and run a gRPC server.
-
-INSTALL
--------
-**1 Clone the gRPC Java git repo**
-```sh
-$ git clone https://github.com/grpc/grpc-java
-```
-
-**2 Install gRPC Java, as described in [How to Build](https://github.com/grpc/grpc-java#how-to-build)**
-```sh
-$ # from this dir
-$ cd grpc-java
-$ # follow the instructions in 'How to Build'
-```
-
-**3 Prepare the app**
-- Clone this git repo
-```sh
-$ git clone https://github.com/grpc/grpc-common
-
-```
-
-**4 Install the app**
-```sh
-$ cd grpc-common/java/android
-$ ./gradlew installDebug
-```
diff --git a/java/android/app/.gitignore b/java/android/app/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/java/android/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/java/android/app/build.gradle b/java/android/app/build.gradle
deleted file mode 100644
index aedf4fe..0000000
--- a/java/android/app/build.gradle
+++ /dev/null
@@ -1,34 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 21
- buildToolsVersion "21.1.2"
-
- defaultConfig {
- applicationId "io.grpc.helloworldexample"
- minSdkVersion 7
- targetSdkVersion 21
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile 'com.android.support:appcompat-v7:21.0.3'
- compile 'com.google.code.findbugs:jsr305:3.0.0'
- compile 'com.squareup.okhttp:okhttp:2.2.0'
- compile 'com.google.guava:guava:18.0'
-
- // You need to build the https://github.com/grpc/grpc-java
- // to obtain these libraries below.
- compile 'io.grpc:grpc-core:0.1.0-SNAPSHOT'
- compile 'io.grpc:grpc-protobuf-nano:0.1.0-SNAPSHOT'
- compile 'io.grpc:grpc-okhttp:0.1.0-SNAPSHOT'
- compile 'io.grpc:grpc-stub:0.1.0-SNAPSHOT'
-}
diff --git a/java/android/app/proguard-rules.pro b/java/android/app/proguard-rules.pro
deleted file mode 100644
index 3e659b9..0000000
--- a/java/android/app/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/thagikura/android-sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/java/android/app/src/main/AndroidManifest.xml b/java/android/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 8c40f11..0000000
--- a/java/android/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/android/app/src/main/java/io/grpc/helloworldexample/GreeterGrpc.java b/java/android/app/src/main/java/io/grpc/helloworldexample/GreeterGrpc.java
deleted file mode 100644
index 817c9fd..0000000
--- a/java/android/app/src/main/java/io/grpc/helloworldexample/GreeterGrpc.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package io.grpc.helloworldexample;
-
-import java.io.IOException;
-
-import static io.grpc.stub.Calls.asyncUnaryCall;
-import static io.grpc.stub.Calls.blockingUnaryCall;
-import static io.grpc.stub.Calls.createMethodDescriptor;
-import static io.grpc.stub.Calls.unaryFutureCall;
-import static io.grpc.stub.ServerCalls.asyncUnaryRequestCall;
-import static io.grpc.stub.ServerCalls.createMethodDefinition;
-
-public class GreeterGrpc {
-
- private static final io.grpc.stub.Method METHOD_SAY_HELLO =
- io.grpc.stub.Method.create(
- io.grpc.MethodType.UNARY, "SayHello",
- io.grpc.protobuf.nano.NanoUtils.marshaller(
- new io.grpc.protobuf.nano.Parser() {
- @Override
- public Helloworld.HelloRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
- return Helloworld.HelloRequest.parseFrom(input);
- }
- }),
- io.grpc.protobuf.nano.NanoUtils.marshaller(
- new io.grpc.protobuf.nano.Parser() {
- @Override
- public Helloworld.HelloReply parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
- return Helloworld.HelloReply.parseFrom(input);
- }
- }));
-
- public static GreeterStub newStub(io.grpc.Channel channel) {
- return new GreeterStub(channel, CONFIG);
- }
-
- public static GreeterBlockingStub newBlockingStub(
- io.grpc.Channel channel) {
- return new GreeterBlockingStub(channel, CONFIG);
- }
-
- public static GreeterFutureStub newFutureStub(
- io.grpc.Channel channel) {
- return new GreeterFutureStub(channel, CONFIG);
- }
-
- public static final GreeterServiceDescriptor CONFIG =
- new GreeterServiceDescriptor();
-
- public static class GreeterServiceDescriptor extends
- io.grpc.stub.AbstractServiceDescriptor {
- public final io.grpc.MethodDescriptor sayHello;
-
- private GreeterServiceDescriptor() {
- sayHello = createMethodDescriptor(
- "helloworld.Greeter", METHOD_SAY_HELLO);
- }
-
- private GreeterServiceDescriptor(
- java.util.Map> methodMap) {
- sayHello = (io.grpc.MethodDescriptor) methodMap.get(
- CONFIG.sayHello.getName());
- }
-
- @java.lang.Override
- protected GreeterServiceDescriptor build(
- java.util.Map> methodMap) {
- return new GreeterServiceDescriptor(methodMap);
- }
-
- @java.lang.Override
- public com.google.common.collect.ImmutableList> methods() {
- return com.google.common.collect.ImmutableList.>of(
- sayHello);
- }
- }
-
- public static interface Greeter {
-
- public void sayHello(Helloworld.HelloRequest request,
- io.grpc.stub.StreamObserver responseObserver);
- }
-
- public static interface GreeterBlockingClient {
-
- public Helloworld.HelloReply sayHello(Helloworld.HelloRequest request);
- }
-
- public static interface GreeterFutureClient {
-
- public com.google.common.util.concurrent.ListenableFuture sayHello(
- Helloworld.HelloRequest request);
- }
-
- public static class GreeterStub extends
- io.grpc.stub.AbstractStub
- implements Greeter {
- private GreeterStub(io.grpc.Channel channel,
- GreeterServiceDescriptor config) {
- super(channel, config);
- }
-
- @java.lang.Override
- protected GreeterStub build(io.grpc.Channel channel,
- GreeterServiceDescriptor config) {
- return new GreeterStub(channel, config);
- }
-
- @java.lang.Override
- public void sayHello(Helloworld.HelloRequest request,
- io.grpc.stub.StreamObserver responseObserver) {
- asyncUnaryCall(
- channel.newCall(config.sayHello), request, responseObserver);
- }
- }
-
- public static class GreeterBlockingStub extends
- io.grpc.stub.AbstractStub
- implements GreeterBlockingClient {
- private GreeterBlockingStub(io.grpc.Channel channel,
- GreeterServiceDescriptor config) {
- super(channel, config);
- }
-
- @java.lang.Override
- protected GreeterBlockingStub build(io.grpc.Channel channel,
- GreeterServiceDescriptor config) {
- return new GreeterBlockingStub(channel, config);
- }
-
- @java.lang.Override
- public Helloworld.HelloReply sayHello(Helloworld.HelloRequest request) {
- return blockingUnaryCall(
- channel.newCall(config.sayHello), request);
- }
- }
-
- public static class GreeterFutureStub extends
- io.grpc.stub.AbstractStub
- implements GreeterFutureClient {
- private GreeterFutureStub(io.grpc.Channel channel,
- GreeterServiceDescriptor config) {
- super(channel, config);
- }
-
- @java.lang.Override
- protected GreeterFutureStub build(io.grpc.Channel channel,
- GreeterServiceDescriptor config) {
- return new GreeterFutureStub(channel, config);
- }
-
- @java.lang.Override
- public com.google.common.util.concurrent.ListenableFuture sayHello(
- Helloworld.HelloRequest request) {
- return unaryFutureCall(
- channel.newCall(config.sayHello), request);
- }
- }
-
- public static io.grpc.ServerServiceDefinition bindService(
- final Greeter serviceImpl) {
- return io.grpc.ServerServiceDefinition.builder("helloworld.Greeter")
- .addMethod(createMethodDefinition(
- METHOD_SAY_HELLO,
- asyncUnaryRequestCall(
- new io.grpc.stub.ServerCalls.UnaryRequestMethod<
- Helloworld.HelloRequest,
- Helloworld.HelloReply>() {
- @java.lang.Override
- public void invoke(
- Helloworld.HelloRequest request,
- io.grpc.stub.StreamObserver responseObserver) {
- serviceImpl.sayHello(request, responseObserver);
- }
- }))).build();
- }
-}
diff --git a/java/android/app/src/main/java/io/grpc/helloworldexample/Helloworld.java b/java/android/app/src/main/java/io/grpc/helloworldexample/Helloworld.java
deleted file mode 100644
index 28da5a9..0000000
--- a/java/android/app/src/main/java/io/grpc/helloworldexample/Helloworld.java
+++ /dev/null
@@ -1,175 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-
-package io.grpc.helloworldexample;
-
-@SuppressWarnings("hiding")
-public interface Helloworld {
-
- public static final class HelloRequest extends
- com.google.protobuf.nano.MessageNano {
-
- private static volatile HelloRequest[] _emptyArray;
- public static HelloRequest[] emptyArray() {
- // Lazily initializes the empty array
- if (_emptyArray == null) {
- synchronized (
- com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {
- if (_emptyArray == null) {
- _emptyArray = new HelloRequest[0];
- }
- }
- }
- return _emptyArray;
- }
-
- // optional string name = 1;
- public java.lang.String name;
-
- public HelloRequest() {
- clear();
- }
-
- public HelloRequest clear() {
- name = "";
- cachedSize = -1;
- return this;
- }
-
- @Override
- public void writeTo(com.google.protobuf.nano.CodedOutputByteBufferNano output)
- throws java.io.IOException {
- if (!this.name.equals("")) {
- output.writeString(1, this.name);
- }
- super.writeTo(output);
- }
-
- @Override
- protected int computeSerializedSize() {
- int size = super.computeSerializedSize();
- if (!this.name.equals("")) {
- size += com.google.protobuf.nano.CodedOutputByteBufferNano
- .computeStringSize(1, this.name);
- }
- return size;
- }
-
- @Override
- public HelloRequest mergeFrom(
- com.google.protobuf.nano.CodedInputByteBufferNano input)
- throws java.io.IOException {
- while (true) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- return this;
- default: {
- if (!com.google.protobuf.nano.WireFormatNano.parseUnknownField(input, tag)) {
- return this;
- }
- break;
- }
- case 10: {
- this.name = input.readString();
- break;
- }
- }
- }
- }
-
- public static HelloRequest parseFrom(byte[] data)
- throws com.google.protobuf.nano.InvalidProtocolBufferNanoException {
- return com.google.protobuf.nano.MessageNano.mergeFrom(new HelloRequest(), data);
- }
-
- public static HelloRequest parseFrom(
- com.google.protobuf.nano.CodedInputByteBufferNano input)
- throws java.io.IOException {
- return new HelloRequest().mergeFrom(input);
- }
- }
-
- public static final class HelloReply extends
- com.google.protobuf.nano.MessageNano {
-
- private static volatile HelloReply[] _emptyArray;
- public static HelloReply[] emptyArray() {
- // Lazily initializes the empty array
- if (_emptyArray == null) {
- synchronized (
- com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {
- if (_emptyArray == null) {
- _emptyArray = new HelloReply[0];
- }
- }
- }
- return _emptyArray;
- }
-
- // optional string message = 1;
- public java.lang.String message;
-
- public HelloReply() {
- clear();
- }
-
- public HelloReply clear() {
- message = "";
- cachedSize = -1;
- return this;
- }
-
- @Override
- public void writeTo(com.google.protobuf.nano.CodedOutputByteBufferNano output)
- throws java.io.IOException {
- if (!this.message.equals("")) {
- output.writeString(1, this.message);
- }
- super.writeTo(output);
- }
-
- @Override
- protected int computeSerializedSize() {
- int size = super.computeSerializedSize();
- if (!this.message.equals("")) {
- size += com.google.protobuf.nano.CodedOutputByteBufferNano
- .computeStringSize(1, this.message);
- }
- return size;
- }
-
- @Override
- public HelloReply mergeFrom(
- com.google.protobuf.nano.CodedInputByteBufferNano input)
- throws java.io.IOException {
- while (true) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- return this;
- default: {
- if (!com.google.protobuf.nano.WireFormatNano.parseUnknownField(input, tag)) {
- return this;
- }
- break;
- }
- case 10: {
- this.message = input.readString();
- break;
- }
- }
- }
- }
-
- public static HelloReply parseFrom(byte[] data)
- throws com.google.protobuf.nano.InvalidProtocolBufferNanoException {
- return com.google.protobuf.nano.MessageNano.mergeFrom(new HelloReply(), data);
- }
-
- public static HelloReply parseFrom(
- com.google.protobuf.nano.CodedInputByteBufferNano input)
- throws java.io.IOException {
- return new HelloReply().mergeFrom(input);
- }
- }
-}
\ No newline at end of file
diff --git a/java/android/app/src/main/java/io/grpc/helloworldexample/HelloworldActivity.java b/java/android/app/src/main/java/io/grpc/helloworldexample/HelloworldActivity.java
deleted file mode 100644
index b6d734f..0000000
--- a/java/android/app/src/main/java/io/grpc/helloworldexample/HelloworldActivity.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package io.grpc.helloworldexample;
-
-import android.content.Context;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
-import android.text.TextUtils;
-import android.view.View;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import java.util.concurrent.TimeUnit;
-
-import io.grpc.ChannelImpl;
-import io.grpc.helloworldexample.Helloworld.HelloReply;
-import io.grpc.helloworldexample.Helloworld.HelloRequest;
-import io.grpc.transport.okhttp.OkHttpChannelBuilder;
-
-public class HelloworldActivity extends ActionBarActivity {
- private Button mSendButton;
- private EditText mHostEdit;
- private EditText mPortEdit;
- private EditText mMessageEdit;
- private TextView mResultText;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_helloworld);
- mSendButton = (Button) findViewById(R.id.send_button);
- mHostEdit = (EditText) findViewById(R.id.host_edit_text);
- mPortEdit = (EditText) findViewById(R.id.port_edit_text);
- mMessageEdit = (EditText) findViewById(R.id.message_edit_text);
- mResultText = (TextView) findViewById(R.id.grpc_response_text);
- }
-
- public void sendMessage(View view) {
- ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
- .hideSoftInputFromWindow(mHostEdit.getWindowToken(), 0);
- mSendButton.setEnabled(false);
- new GrpcTask().execute();
- }
-
- private class GrpcTask extends AsyncTask {
- private String mHost;
- private String mMessage;
- private int mPort;
- private ChannelImpl mChannel;
-
- @Override
- protected void onPreExecute() {
- mHost = mHostEdit.getText().toString();
- mMessage = mMessageEdit.getText().toString();
- String portStr = mPortEdit.getText().toString();
- mPort = TextUtils.isEmpty(portStr) ? 0 : Integer.valueOf(portStr);
- mResultText.setText("");
- }
-
- private String sayHello(ChannelImpl channel) {
- GreeterGrpc.GreeterBlockingStub stub = GreeterGrpc.newBlockingStub(channel);
- HelloRequest message = new HelloRequest();
- message.name = mMessage;
- HelloReply reply = stub.sayHello(message);
- return reply.message;
- }
-
- @Override
- protected String doInBackground(Void... nothing) {
- try {
- mChannel = OkHttpChannelBuilder.forAddress(mHost, mPort).build();
- return sayHello(mChannel);
- } catch (Exception e) {
- return "Failed... : " + e.getMessage();
- }
- }
-
- @Override
- protected void onPostExecute(String result) {
- try {
- mChannel.shutdown().awaitTerminated(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- mResultText.setText(result);
- mSendButton.setEnabled(true);
- }
- }
-}
\ No newline at end of file
diff --git a/java/android/app/src/main/res/layout/activity_helloworld.xml b/java/android/app/src/main/res/layout/activity_helloworld.xml
deleted file mode 100644
index 00ca04c..0000000
--- a/java/android/app/src/main/res/layout/activity_helloworld.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/java/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/java/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bc..0000000
Binary files a/java/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/java/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/java/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c133a0c..0000000
Binary files a/java/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/java/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/java/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index bfa42f0..0000000
Binary files a/java/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/java/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/java/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 324e72c..0000000
Binary files a/java/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/java/android/app/src/main/res/values/strings.xml b/java/android/app/src/main/res/values/strings.xml
deleted file mode 100644
index 64cb312..0000000
--- a/java/android/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- GrpcHelloworldExample
-
diff --git a/java/android/build.gradle b/java/android/build.gradle
deleted file mode 100644
index 1bf89c9..0000000
--- a/java/android/build.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-allprojects {
- repositories {
- jcenter()
- mavenLocal()
- }
-}
diff --git a/java/android/gradle/wrapper/gradle-wrapper.jar b/java/android/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64..0000000
Binary files a/java/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/java/android/gradle/wrapper/gradle-wrapper.properties b/java/android/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 0c71e76..0000000
--- a/java/android/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/java/android/gradlew b/java/android/gradlew
deleted file mode 100755
index 91a7e26..0000000
--- a/java/android/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/java/android/gradlew.bat b/java/android/gradlew.bat
deleted file mode 100644
index aec9973..0000000
--- a/java/android/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/java/android/settings.gradle b/java/android/settings.gradle
deleted file mode 100644
index e7b4def..0000000
--- a/java/android/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':app'
diff --git a/java/javatutorial.md b/java/javatutorial.md
deleted file mode 100644
index 7e305a1..0000000
--- a/java/javatutorial.md
+++ /dev/null
@@ -1,493 +0,0 @@
-#gRPC Basics: Java
-
-This tutorial provides a basic Java programmer's introduction to working with gRPC. By walking through this example you'll learn how to:
-
-- Define a service in a .proto file.
-- Generate server and client code using the protocol buffer compiler.
-- Use the Java gRPC API to write a simple client and server for your service.
-
-It assumes that you have read the [Getting started](https://github.com/grpc/grpc-common) guide and are familiar with [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). Note that the example in this tutorial uses the [proto3](https://github.com/google/protobuf/releases) version of the protocol buffers language, which is currently in alpha release: you can find out more in the [proto3 language guide](https://developers.google.com/protocol-buffers/docs/proto3) and see the [release notes](https://github.com/google/protobuf/releases) for the new version in the protocol buffers Github repository.
-
-This isn't a comprehensive guide to using gRPC in Java: more reference documentation is coming soon.
-
-## Why use gRPC?
-
-Our example is a simple route mapping application that lets clients get information about features on their route, create a summary of their route, and exchange route information such as traffic updates with the server and other clients.
-
-With gRPC we can define our service once in a .proto file and implement clients and servers in any of gRPC's supported languages, which in turn can be run in environments ranging from servers inside Google to your own tablet - all the complexity of communication between different languages and environments is handled for you by gRPC. We also get all the advantages of working with protocol buffers, including efficient serialization, a simple IDL, and easy interface updating.
-
-## Example code and setup
-
-The example code for our tutorial is in [grpc/grpc-java/examples/src/main/java/io/grpc/examples](https://github.com/grpc/grpc-java/tree/master/examples/src/main/java/io/grpc/examples). To download the example, clone the `grpc-java` repository by running the following command:
-```shell
-$ git clone https://github.com/grpc/grpc-java.git
-```
-
-Then change your current directory to `grpc-java/examples`:
-```shell
-$ cd grpc-java/examples
-```
-
-You also should have the relevant tools installed to generate the server and client interface code - if you don't already, follow the setup instructions in [the Java quick start guide](https://github.com/grpc/grpc-common/tree/master/java).
-
-
-## Defining the service
-
-Our first step (as you'll know from [Getting started](https://github.com/grpc/grpc-common)) is to define the gRPC *service* and the method *request* and *response* types using [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). You can see the complete .proto file in [`grpc-java/examples/src/main/proto/route_guide.proto`](https://github.com/grpc/grpc-java/blob/master/examples/src/main/proto/route_guide.proto).
-
-As we're generating Java code in this example, we've specified a `java_package` file option in our .proto:
-```proto
-option java_package = "io.grpc.examples";
-```
-
-This specifies the package we want to use for our generated Java classes. If no explicit `java_package` option is given in the .proto file, then by default the proto package (specified using the "package" keyword) will be used. However, proto packages generally do not make good Java packages since proto packages are not expected to start with reverse domain names. If we generate code in another language from this .proto, the `java_package` option has no effect.
-
-To define a service, we specify a named `service` in the .proto file:
-
-```proto
-service RouteGuide {
- ...
-}
-```
-
-Then we define `rpc` methods inside our service definition, specifying their request and response types. gRPC lets you define four kinds of service method, all of which are used in the `RouteGuide` service:
-
-- A *simple RPC* where the client sends a request to the server using the stub and waits for a response to come back, just like a normal function call.
-```proto
- // Obtains the feature at a given position.
- rpc GetFeature(Point) returns (Feature) {}
-```
-
-- A *server-side streaming RPC* where the client sends a request to the server and gets a stream to read a sequence of messages back. The client reads from the returned stream until there are no more messages. As you can see in our example, you specify a server-side streaming method by placing the `stream` keyword before the *response* type.
-```proto
- // Obtains the Features available within the given Rectangle. Results are
- // streamed rather than returned at once (e.g. in a response message with a
- // repeated field), as the rectangle may cover a large area and contain a
- // huge number of features.
- rpc ListFeatures(Rectangle) returns (stream Feature) {}
-```
-
-- A *client-side streaming RPC* where the client writes a sequence of messages and sends them to the server, again using a provided stream. Once the client has finished writing the messages, it waits for the server to read them all and return its response. You specify a server-side streaming method by placing the `stream` keyword before the *request* type.
-```proto
- // Accepts a stream of Points on a route being traversed, returning a
- // RouteSummary when traversal is completed.
- rpc RecordRoute(stream Point) returns (RouteSummary) {}
-```
-
-- A *bidirectional streaming RPC* where both sides send a sequence of messages using a read-write stream. The two streams operate independently, so clients and servers can read and write in whatever order they like: for example, the server could wait to receive all the client messages before writing its responses, or it could alternately read a message then write a message, or some other combination of reads and writes. The order of messages in each stream is preserved. You specify this type of method by placing the `stream` keyword before both the request and the response.
-```proto
- // Accepts a stream of RouteNotes sent while a route is being traversed,
- // while receiving other RouteNotes (e.g. from other users).
- rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
-```
-
-Our .proto file also contains protocol buffer message type definitions for all the request and response types used in our service methods - for example, here's the `Point` message type:
-```proto
-// Points are represented as latitude-longitude pairs in the E7 representation
-// (degrees multiplied by 10**7 and rounded to the nearest integer).
-// Latitudes should be in the range +/- 90 degrees and longitude should be in
-// the range +/- 180 degrees (inclusive).
-message Point {
- int32 latitude = 1;
- int32 longitude = 2;
-}
-```
-
-
-## Generating client and server code
-
-Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler `protoc` with a special gRPC Java plugin. You need to use the [proto3](https://github.com/google/protobuf/releases) compiler in order to generate gRPC services
-
-For simplicity, we've provided a [Gradle build file](https://github.com/grpc/grpc-java/blob/master/examples/build.gradle) that runs `protoc` for you with the appropriate plugin, input, and output (if you want to run this yourself, make sure you've installed protoc and followed the gRPC code [installation instructions](https://github.com/grpc/grpc-java) first):
-
-```shell
-../gradlew build
-```
-
-which actually runs:
-
-```shell
-protoc -I examples/src/main/proto -I examples/build/extracted-protos/main --java_out=examples/build/generated-sources/main --java_plugin_out=examples/build/generated-sources/main --plugin=protoc-gen-java_plugin=compiler/build/binaries/java_pluginExecutable/java_plugin examples/src/main/proto/route_guide.proto
-```
-
-Running this command generates the following files:
-- `RouteGuideOuterClass.java`, which contains all the protocol buffer code to populate, serialize, and retrieve our request and response message types
-- `RouteGuideGrpc.java` which contains (along with some other useful code):
- - an interface for `RouteGuide` servers to implement, `RouteGuideGrpc.Service`, with all the methods defined in the `RouteGuide` service.
- - *stub* classes that clients can use to talk to a `RouteGuide` server. These also implement the `RouteGuide` interface.
-
-
-
-## Creating the server
-
-First let's look at how we create a `RouteGuide` server. If you're only interested in creating gRPC clients, you can skip this section and go straight to [Creating the client](#client) (though you might find it interesting anyway!).
-
-There are two parts to making our `RouteGuide` service do its job:
-- Implementing the service interface generated from our service definition: doing the actual "work" of our service.
-- Running a gRPC server to listen for requests from clients and return the service responses.
-
-You can find our example `RouteGuide` server in [grpc-java/examples/src/main/java/io/grpc/examples/RouteGuideServer.java](https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/RouteGuideServer.java). Let's take a closer look at how it works.
-
-### Implementing RouteGuide
-
-As you can see, our server has a `RouteGuideService` class that implements the generated `RouteGuideGrpc.Service` interface:
-
-```java
-private static class RouteGuideService implements RouteGuideGrpc.RouteGuide {
-...
-}
-```
-#### Simple RPC
-`RouteGuideService` implements all our service methods. Let's look at the simplest type first, `GetFeature`, which just gets a `Point` from the client and returns the corresponding feature information from its database in a `Feature`.
-
-```java
- @Override
- public void getFeature(Point request, StreamObserver responseObserver) {
- responseObserver.onValue(getFeature(request));
- responseObserver.onCompleted();
- }
-
-...
-
- private Feature getFeature(Point location) {
- for (Feature feature : features) {
- if (feature.getLocation().getLatitude() == location.getLatitude()
- && feature.getLocation().getLongitude() == location.getLongitude()) {
- return feature;
- }
- }
-
- // No feature was found, return an unnamed feature.
- return Feature.newBuilder().setName("").setLocation(location).build();
- }
-```
-
-`getFeature()` takes two parameters:
-- `Point`: the request
-- `StreamObserver`: a response observer, which is a special interface for the server to call with its response.
-
-To return our response to the client and complete the call:
-
-1. We construct and populate a `Feature` response object to return to the client, as specified in our service definition. In this example, we do this in a separate private `getFeature()` method.
-2. We use the response observer's `onValue()` method to return the `Feature`.
-3. We use the response observer's `onCompleted()` method to specify that we've finished dealing with the RPC.
-
-#### Server-side streaming RPC
-Next let's look at one of our streaming RPCs. `ListFeatures` is a server-side streaming RPC, so we need to send back multiple `Feature`s to our client.
-
-```java
-private final Collection features;
-
-...
-
- @Override
- public void listFeatures(Rectangle request, StreamObserver responseObserver) {
- int left = min(request.getLo().getLongitude(), request.getHi().getLongitude());
- int right = max(request.getLo().getLongitude(), request.getHi().getLongitude());
- int top = max(request.getLo().getLatitude(), request.getHi().getLatitude());
- int bottom = min(request.getLo().getLatitude(), request.getHi().getLatitude());
-
- for (Feature feature : features) {
- if (!RouteGuideUtil.exists(feature)) {
- continue;
- }
-
- int lat = feature.getLocation().getLatitude();
- int lon = feature.getLocation().getLongitude();
- if (lon >= left && lon <= right && lat >= bottom && lat <= top) {
- responseObserver.onValue(feature);
- }
- }
- responseObserver.onCompleted();
- }
-```
-
-Like the simple RPC, this method gets a request object (the `Rectangle` in which our client wants to find `Feature`s) and a `StreamObserver` response observer.
-
-This time, we get as many `Feature` objects as we need to return to the client (in this case, we select them from the service's feature collection based on whether they're inside our request `Rectangle`), and write them each in turn to the response observer using its `Write()` method. Finally, as in our simple RPC, we use the response observer's `onCompleted()` method to tell gRPC that we've finished writing responses.
-
-#### Client-side streaming RPC
-Now let's look at something a little more complicated: the client-side streaming method `RecordRoute`, where we get a stream of `Point`s from the client and return a single `RouteSummary` with information about their trip.
-
-```java
- @Override
- public StreamObserver recordRoute(final StreamObserver responseObserver) {
- return new StreamObserver