Skip to content

Commit 5d3d4cb

Browse files
committed
Merge pull request #168 from uber/ajs-cleanup
Cleanup before 1.0 release
2 parents 8e7c6c9 + 318322b commit 5d3d4cb

File tree

10 files changed

+151
-215
lines changed

10 files changed

+151
-215
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ go:
33
- 1.4
44
- 1.5
55
install: make install_ci
6-
6+
script: make test_ci
7+
after_success: make cover_ci

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Changelog
2+
=========
3+
4+
# 1.0.0
5+
6+
* First stable release.
7+
* Supports making calls with JSON, Thrift or raw payloads.
8+
* Services use thrift-gen, and implement handlers wiht a `func(ctx, arg) (res,
9+
error)` signature.
10+
* Supports retries.
11+
* Peer selection (peer heap, prefer incoming strategy, for use with Hyperbahn).
12+
* Graceful channel shutdown.
13+
* TCollector trace reporter with sampling support.
14+
* Metrics collection with StatsD.
15+
* Thrift support, including includes.

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Contributing
2+
============
3+
4+
We'd love your help making tchannel-go great!
5+
6+
## Getting Started
7+
8+
TChannel uses [godep](https://github.com/tools/godep) to manage dependencies.
9+
To get started:
10+
11+
```bash
12+
go get github.com/uber/tchannel-go
13+
go get github.com/tools/godep
14+
cd $GOPATH/src/github.com/uber/tchannel-go
15+
godep restore
16+
make # tests should pass
17+
```
18+
19+
## Making A Change
20+
21+
*Before making any significant changes, please [open an
22+
issue](https://github.com/uber/tchannel-go/issues).* Discussing your proposed
23+
changes ahead of time will make the contribution process smooth for everyone.
24+
25+
Once we've discussed your changes and you've got your code ready, make sure
26+
that tests are passing (`make test` or `make cover`) and open your PR! Your
27+
pull request is most likely to be accepted if it:
28+
29+
* Includes tests for new functionality.
30+
* Follows the guidelines in [Effective
31+
Go](https://golang.org/doc/effective_go.html) and the [Go team's common code
32+
review comments](https://github.com/golang/go/wiki/CodeReviewComments).
33+
* Has a [good commit
34+
message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).

LICENSE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2015 Uber Technologies, Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ install:
4646
GOPATH=$(GODEPS) godep restore
4747

4848
install_ci: get_thrift install
49+
go get -u github.com/mattn/goveralls
4950

5051
help:
5152
@egrep "^# target:" [Mm]akefile | sort -
@@ -78,12 +79,17 @@ benchmark: clean setup
7879
echo Running benchmarks:
7980
go test $(PKGS) -bench=. -parallel=4
8081

81-
cover: clean setup
82-
echo Testing packages:
82+
cover_profile: clean setup
83+
@echo Testing packages:
8384
mkdir -p $(BUILD)
84-
go test ./ $(TEST_ARG) -coverprofile=$(BUILD)/coverage.out
85+
go test ./ $(TEST_ARG) -coverprofile=$(BUILD)/coverage.out
86+
87+
cover: cover_profile
8588
go tool cover -html=$(BUILD)/coverage.out
8689

90+
cover_ci: cover_profile
91+
goveralls -coverprofile=$(BUILD)/coverage.out -service=travis-ci
92+
8793
vet:
8894
echo Vetting packages for potential issues...
8995
go tool vet $(PKGS)

README.md

Lines changed: 47 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,67 @@
1-
# TChannel
1+
# TChannel [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
22

3-
[![GoDoc](https://godoc.org/github.com/uber/tchannel-go?status.svg)](https://godoc.org/github.com/uber/tchannel-go)
4-
[![Build Status](https://travis-ci.org/uber/tchannel-go.svg?branch=master)](https://travis-ci.org/uber/tchannel-go)
3+
[TChannel][tchan-spec] is a multiplexing and framing protocol for RPC calls.
4+
tchannel-go is a Go implementation of the protocol, including client libraries
5+
for [Hyperbahn][hyperbahn].
56

6-
[TChannel](https://github.com/uber/tchannel/blob/master/docs/protocol.md) is a multiplexing and framing protocol for RPC calls.
7-
8-
tchannel-go is a Go implementation of the TChannel protocol, and includes client libraries for [Hyperbahn](https://github.com/uber/hyperbahn).
9-
10-
## Stability: experimental
11-
12-
NOTE: `master:golang` is **not yet stable**
13-
14-
## Thrift + TChannel Integration
15-
16-
If you want to use Thrift+TChannel, you will want to read [this guide](guide/Thrift_Hyperbahn.md).
17-
18-
## Getting Started
19-
20-
Get Go from your package manager of choice or follow the [official installation instructions](https://golang.org/doc/install).
21-
22-
```bash
23-
brew install go
24-
25-
# This will be your GOPATH where all Go code will live.
26-
mkdir -p ~/gocode/src
27-
```
28-
29-
Set up your environment for your shell of choice.
30-
31-
```bash
32-
export GOPATH="${HOME}/gocode"
33-
export PATH="${PATH}":"${GOPATH}/bin"
34-
```
35-
36-
TChannel uses [godep](https://github.com/tools/godep) to manage dependencies. To get started:
37-
38-
```bash
39-
go get github.com/uber/tchannel-go
40-
go get github.com/tools/godep
41-
cd $GOPATH/src/github.com/uber/tchannel-go
42-
godep restore
43-
make
44-
```
45-
### Examples
46-
47-
Simple examples are included which demonstrate the TChannel API and features.
48-
49-
50-
#### PingPong
51-
```bash
52-
./build/examples/ping/pong
53-
```
54-
55-
This example creates a client and server channel. The server channel registers a PingService
56-
with a ping method, which takes request Headers and a Ping body and returns the
57-
same Headers along with a Pong body. The client sends a ping request to the server
58-
59-
Note that every instance is bidirectional, so the same channel can be used for both sending
60-
and receiving requests to peers. New connections are initiated on demand.
61-
62-
63-
#### KeyValue
64-
```bash
65-
./build/examples/keyvalue/server
66-
./build/examples/keyvalue/client
67-
```
68-
69-
This example exposes a simple keyvalue service over TChannel using the Thrift protocol.
70-
The client has an interactive CLI that can be used to make calls to the server.
7+
If you'd like to start by writing a small Thrift and TChannel service, check
8+
out [this guide](guide/Thrift_Hyperbahn.md). For a less opinionated setup, see
9+
the [contribution guidelines](CONTRIBUTING.md).
7110

7211
## Overview
7312

74-
TChannel is a network protocol with the following goals:
13+
TChannel is a network protocol that supports:
7514

76-
* request / response model
77-
* multiple requests multiplexed across the same TCP socket
78-
* out of order responses
79-
* streaming request and responses
80-
* all frames checksummed
81-
* transport arbitrary payloads
82-
* easy to implement in multiple languages
83-
* near-redis performance
15+
* A request/response model,
16+
* Multiplexing multiple requests across the same TCP socket,
17+
* Out-of-order responses,
18+
* Streaming requests and responses,
19+
* Checksummed frames,
20+
* Transport of arbitrary payloads,
21+
* Easy implementation in many languages, and
22+
* Redis-like performance.
8423

85-
This protocol is intended to run on datacenter networks for inter-process communication.
24+
This protocol is intended to run on datacenter networks for inter-process
25+
communication.
8626

8727
## Protocol
8828

89-
TChannel frames have a fixed length header and 3 variable length fields. The underlying protocol
90-
does not assign meaning to these fields, but the included client/server implementation uses
91-
the first field to represent a unique endpoint or function name in an RPC model.
92-
The next two fields can be used for arbitrary data. Some suggested way to use the 3 fields are:
29+
TChannel frames have a fixed-length header and 3 variable-length fields. The
30+
underlying protocol does not assign meaning to these fields, but the included
31+
client/server implementation uses the first field to represent a unique
32+
endpoint or function name in an RPC model. The next two fields can be used for
33+
arbitrary data. Some suggested way to use the 3 fields are:
9334

94-
* URI path, HTTP method and headers as JSON, body
95-
* function name, headers, thrift / protobuf
35+
* URI path + HTTP method and headers as JSON + body, or
36+
* Function name + headers + thrift/protobuf.
9637

97-
Note however that the only encoding supported by TChannel is UTF-8. If you want JSON, you'll need
98-
to stringify and parse outside of TChannel.
38+
Note, however, that the only encoding supported by TChannel is UTF-8. If you
39+
want JSON, you'll need to stringify and parse outside of TChannel.
9940

100-
This design supports efficient routing and forwarding of data where the routing information needs
101-
to parse only the first or second field, but the 3rd field is forwarded without parsing.
41+
This design supports efficient routing and forwarding: routers need to parse
42+
the first or second field, but can forward the third field without parsing.
10243

103-
There is no notion of client and server in this system. Every TChannel instance is capable of
104-
making or receiving requests, and thus requires a unique port on which to listen. This requirement may
105-
change in the future.
44+
There is no notion of client and server in this system. Every TChannel instance
45+
is capable of making and receiving requests, and thus requires a unique port on
46+
which to listen. This requirement may change in the future.
10647

107-
- See [protocol.md](https://github.com/uber/tchannel/blob/master/docs/protocol.md) for more details
48+
See the [protocol specification][tchan-proto-spec] for more details.
10849

109-
## Further examples
50+
## Examples
11051

111-
- [ping](examples/ping/main.go): A simple ping/pong example using raw TChannel.
52+
- [ping](examples/ping): A simple ping/pong example using raw TChannel.
11253
- [thrift](examples/thrift): A Thrift server/client example.
11354
- [keyvalue](examples/keyvalue): A keyvalue Thrift service with separate server and client binaries.
11455

115-
## Tests
116-
117-
`make test` or `make cover`
118-
119-
## Contributors
120-
121-
- mmihic
122-
- prashantv
123-
124-
## MIT Licenced
56+
<hr>
57+
This project is released under the [MIT License](LICENSE.md).
58+
59+
[doc-img]: https://godoc.org/github.com/uber/tchannel-go?status.svg
60+
[doc]: https://godoc.org/github.com/uber/tchannel-go
61+
[ci-img]: https://travis-ci.org/uber/tchannel-go.svg?branch=master
62+
[ci]: https://travis-ci.org/uber/tchannel-go
63+
[cov-img]: https://coveralls.io/repos/uber/tchannel-go/badge.svg?branch=master&service=github
64+
[cov]: https://coveralls.io/github/uber/tchannel-go?branch=master
65+
[tchan-spec]: http://tchannel.readthedocs.org/en/latest/
66+
[tchan-proto-spec]: http://tchannel.readthedocs.org/en/latest/protocol/
67+
[hyperbahn]: https://github.com/uber/hyperbahn

TODO.md

Lines changed: 0 additions & 106 deletions
This file was deleted.

examples/keyvalue/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Key-Value Store
2+
3+
```bash
4+
./build/examples/keyvalue/server
5+
./build/examples/keyvalue/client
6+
```
7+
8+
This example exposes a simple key-value store over TChannel using the Thrift
9+
protocol. The client has an interactive CLI that can be used to make calls to
10+
the server.

0 commit comments

Comments
 (0)