Skip to content

Commit

Permalink
replace all grpc-common occurances with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Aug 27, 2015
1 parent 20fa669 commit 0a26821
Show file tree
Hide file tree
Showing 24 changed files with 144 additions and 143 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Copyright 2015 Google Inc.

#Documentation

You can find more detailed documentation and examples in the [grpc-common repository](http://github.com/grpc/grpc-common).
You can find more detailed documentation and examples in the [doc](doc) and [examples](examples) directories respectively.

#Installation

Expand Down Expand Up @@ -95,7 +95,7 @@ messages are delivered in the order they were sent.

#Protocol

The [gRPC protocol](https://github.com/grpc/grpc-common/blob/master/PROTOCOL-HTTP2.md) specifies the abstract requirements for communication between
The [gRPC protocol](examples/PROTOCOL-HTTP2.md) specifies the abstract requirements for communication between
clients and servers. A concrete embedding over HTTP/2 completes the picture by
fleshing out the details of each of the required operations.

Expand Down
2 changes: 1 addition & 1 deletion doc/grpc-auth-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ call.requestMetadata[@"Authorization"] = [@"Bearer " stringByAppendingString:acc
[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).
You can see a working example app, with a more detailed explanation, [here](examples/objective-c/auth_sample).
### Authenticating with Google (Python)
```python
Expand Down
2 changes: 1 addition & 1 deletion doc/interop-test-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Interoperability Test Case Descriptions
Client and server use
[test.proto](https://github.com/grpc/grpc/blob/master/test/proto/test.proto)
and the [gRPC over HTTP/2 v2
protocol](https://github.com/grpc/grpc-common/blob/master/PROTOCOL-HTTP2.md).
protocol](examples/doc/PROTOCOL-HTTP2.md).

Client
------
Expand Down
31 changes: 16 additions & 15 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ Hello World example. You'll find more tutorials and reference docs in this repos
<a name="quickstart"></a>
## 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)
* [C++](examples/cpp)
* [Java](https://github.com/grpc/grpc-java/tree/master/examples)
* [Go](https://github.com/grpc/grpc-go/tree/master/examples)
* [Ruby](examples/ruby)
* [Node.js](examples/node)
* [Android Java](examples/java/android)
* [Python](examples/python/helloworld)
* [C#](examples/csharp)
* [Objective-C](examples/objective-c/route_guide)
* [PHP](examples/php)

## What's in this repository?

The `grpc-common` repository contains documentation, resources, and examples
The `examples` directory contains documentation, resources, and examples
for all gRPC users. You can find examples and instructions specific to your
favourite language in the relevant subdirectory.

Expand Down Expand Up @@ -93,8 +94,8 @@ Hello World method.
- 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:
The complete code for the example is available in the `examples`
directory. 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.

Expand Down Expand Up @@ -400,8 +401,8 @@ 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),
directory](https://github.com/grpc/grpc-go/tree/master/examples) and look at the
[`greeter_client`](https://github.com/grpc/grpc-go/blob/master/examples/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`:
Expand Down Expand Up @@ -446,4 +447,4 @@ $ 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.
- [gRPC Authentication Support](doc/grpc-auth-support.md) introduces authentication support in gRPC with supported mechanisms and examples.
18 changes: 9 additions & 9 deletions examples/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ To install gRPC on your system, follow the instructions here:

## 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).
Here's how to build and run the C++ implementation of the [Hello World](examples/protos/helloworld.proto) example used in [Getting started](https://github.com/grpc/grpc/tree/master/examples).

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
The example code for this and our other examples lives in the `examples`
directory. Clone this repository to your local machine by running the
following command:


```sh
$ git clone https://github.com/grpc/grpc-common.git
$ git clone https://github.com/grpc/grpc.git
```

Change your current directory to grpc-common/cpp/helloworld
Change your current directory to examples/cpp/helloworld

```sh
$ cd grpc-common/cpp/helloworld/
$ cd examples/cpp/helloworld/
```


Expand All @@ -41,9 +41,9 @@ $ 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 client implementation is at [greeter_client.cc](examples/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).
The server implementation is at [greeter_server.cc](examples/cpp/helloworld/greeter_server.cc).

### Try it!
Build client and server:
Expand All @@ -62,4 +62,4 @@ If things go smoothly, you will see the "Greeter received: Hello world" in the c

## Tutorial

You can find a more detailed tutorial in [gRPC Basics: C++](https://github.com/grpc/grpc-common/blob/master/cpp/cpptutorial.md)
You can find a more detailed tutorial in [gRPC Basics: C++](examples/cpp/cpptutorial.md)
20 changes: 10 additions & 10 deletions examples/cpp/cpptutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This tutorial provides a basic C++ programmer's introduction to working with gRP
- 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.
It assumes that you have read the [Getting started](https://github.com/grpc/grpc/tree/master/examples) 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.

Expand All @@ -18,22 +18,22 @@ With gRPC we can define our service once in a .proto file and implement clients

## 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:
The example code for our tutorial is in [examples/cpp/route_guide](examples/cpp/route_guide). To download the example, clone this repository by running the following command:
```shell
$ git clone https://github.com/grpc/grpc-common.git
$ git clone https://github.com/grpc/grpc.git
```

Then change your current directory to `grpc-common/cpp/route_guide`:
Then change your current directory to `examples/cpp/route_guide`:
```shell
$ cd grpc-common/cpp/route_guide
$ cd examples/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).
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](examples/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).
Our first step (as you'll know from [Getting started](examples/) 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 [`examples/protos/route_guide.proto`](examples/protos/route_guide.proto).

To define a service, you specify a named `service` in your .proto file:

Expand Down Expand Up @@ -91,7 +91,7 @@ message Point {

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):
For simplicity, we've provided a [makefile](examples/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
Expand Down Expand Up @@ -126,7 +126,7 @@ 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.
You can find our example `RouteGuide` server in [examples/cpp/route_guide/route_guide_server.cc](examples/cpp/route_guide/route_guide_server.cc). Let's take a closer look at how it works.

### Implementing RouteGuide

Expand Down Expand Up @@ -236,7 +236,7 @@ As you can see, we build and start our server using a `ServerBuilder`. To do thi
<a name="client"></a>
## 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).
In this section, we'll look at creating a C++ client for our `RouteGuide` service. You can see our complete example client code in [examples/cpp/route_guide/route_guide_client.cc](examples/cpp/route_guide/route_guide_client.cc).

### Creating a stub

Expand Down
20 changes: 10 additions & 10 deletions examples/cpp/helloworld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ Make sure you have installed gRPC on your system. Follow the instructions here:

### 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
The example code for this and our other examples lives in the `examples`
directory. Clone this repository to your local machine by running the
following command:


```sh
$ git clone https://github.com/grpc/grpc-common.git
$ git clone https://github.com/grpc/grpc.git
```

Change your current directory to grpc-common/cpp/helloworld
Change your current directory to examples/cpp/helloworld

```sh
$ cd grpc-common/cpp/helloworld/
$ cd examples/cpp/helloworld/
```

### Defining a service
Expand All @@ -34,7 +34,7 @@ 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`
[helloworld.proto](examples/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
Expand Down Expand Up @@ -124,7 +124,7 @@ $ protoc -I ../../protos/ --cpp_out=. ../../protos/helloworld.proto
}
```
For a working example, refer to [greeter_client.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_client.cc).
For a working example, refer to [greeter_client.cc](examples/cpp/helloworld/greeter_client.cc).
### Writing a server
Expand Down Expand Up @@ -152,7 +152,7 @@ For a working example, refer to [greeter_client.cc](https://github.com/grpc/grpc
std::unique_ptr<Server> 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).
For a working example, refer to [greeter_server.cc](examples/cpp/helloworld/greeter_server.cc).
### Writing asynchronous client and server
Expand Down Expand Up @@ -194,7 +194,7 @@ The channel and stub creation code is the same as the sync client.
}
```
For a working example, refer to [greeter_async_client.cc](https://github.com/grpc/grpc-common/blob/master/cpp/helloworld/greeter_async_client.cc).
For a working example, refer to [greeter_async_client.cc](examples/cpp/helloworld/greeter_async_client.cc).
#### Async server
Expand Down Expand Up @@ -253,7 +253,7 @@ 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).
For a working example, refer to [greeter_async_server.cc](examples/cpp/helloworld/greeter_async_server.cc).
Expand Down
2 changes: 1 addition & 1 deletion examples/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ On Linux or Mac, use `mono GreeterServer.exe` and `mono GreeterClient.exe` to ru
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)
You can find a more detailed tutorial in [gRPC Basics: C#](examples/csharp/route_guide/README.md)
Loading

0 comments on commit 0a26821

Please sign in to comment.