Skip to content
Go implementation of a multiplexing and framing protocol for RPC calls
Branch: dev
Clone or download
Latest commit 95fb962 May 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmark Update glide deps, add multierr for #734 (#735) May 1, 2019
crossdock thrift: Return error if we didn't decode a known exception (#566) Jan 19, 2017
examples Update glide deps, add multierr for #734 (#735) May 1, 2019
guide Update tchannel/golang imports to tchannel-go Oct 3, 2015
http Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
hyperbahn Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
internal/argreader Ensure reader is empty before calling Close (#564) Jan 19, 2017
json Small test cleanups (#551) Dec 21, 2016
peers Update glide deps, add multierr for #734 (#735) May 1, 2019
pprof Fix import ordering Jun 17, 2016
raw Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
relay relay: Fix stuck calls when client TCP buffer is full (#731) May 2, 2019
scripts Delete unused changelog_halp script Feb 1, 2018
stats stats: Fix flaky test TestTallyIntegration (#694) Apr 2, 2018
testutils Fix flaky TestRaceExchangesWithClose, TestRelayBasedSweep (#738) May 2, 2019
thrift Update glide deps, add multierr for #734 (#735) May 1, 2019
tnet Wrap a net.Listener for better Close semantics Jan 5, 2016
tos Set DiffServ (QoS) bit on Outbound Connections (#516) Mar 22, 2017
trace Restore trace package (#486) Aug 17, 2016
trand Move threadsafe rand.Rand to a package May 4, 2016
typed Check max string length when using WriteLenXString (#728) Feb 22, 2019
.gitignore ping: Don't close connection on errors (#655) Sep 28, 2017
.travis.yml Update Go versions to 1.11 and 1.12 (#736) May 2, 2019
CHANGELOG.md Update CHANGELOG and version in prep for 1.14.0 release (#742) May 20, 2019
CODE_OF_CONDUCT.md Add a code of conduct (#711) Jul 23, 2018
CONTRIBUTING.md Version 1.3.0 Preparation (#576) Feb 2, 2017
LICENSE.md Add a separate license file Jan 8, 2016
Makefile Update Go versions to 1.11 and 1.12 (#736) May 2, 2019
README.md README: Switch to travis-ci.com for badge (#732) May 1, 2019
RELEASE.md Update RELEASE document to mention "-b" Feb 1, 2018
all_channels.go Log Info level logs on channel creation (#622) Apr 19, 2017
all_channels_test.go introspection: Only include other channels if requested (#474) Aug 5, 2016
arguments.go Ensure reader is empty before calling Close (#564) Jan 19, 2017
arguments_test.go Ensure reader is empty before calling Close (#564) Jan 19, 2017
calloptions.go Expose `CallOptions` caller name for transparent proxying (#741) May 16, 2019
calloptions_test.go Expose `CallOptions` caller name for transparent proxying (#741) May 16, 2019
channel.go Update glide deps, add multierr for #734 (#735) May 1, 2019
channel_test.go log: Use serviceName key for channel logs, DRY up logger creation (#662) Nov 1, 2017
channel_utils_test.go Simplify testutils.NewServer and NewChannel Nov 7, 2015
channelstate_string.go Add ChannelState to progress the state of a channel as it closes. Aug 3, 2015
checksum.go Pool checksum objects Jan 5, 2016
close_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
codecov.yml Add codecov.yml file with ignores for _string.go (#654) Sep 27, 2017
conn_leak_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
connection.go Update glide deps, add multierr for #734 (#735) May 1, 2019
connection_bench_test.go Fix import ordering Jun 17, 2016
connection_direction.go Refactor add*Connection to be shared May 18, 2016
connection_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
connectionstate_string.go Only create Connection object for active TChannel connections (#587) Feb 24, 2017
context.go Expose `CallOptions` caller name for transparent proxying (#741) May 16, 2019
context_builder.go context: If parent has deadline, and timeout is 0, use WithCancel (#691) Apr 2, 2018
context_header.go Add tchannel.WithoutHeaders (#637) Aug 3, 2017
context_internal_test.go Add tchannel.WithoutHeaders (#637) Aug 3, 2017
context_test.go context: If parent has deadline, and timeout is 0, use WithCancel (#691) Apr 2, 2018
deps_test.go testutils: Verify "pending" calls before connection close (#734) May 2, 2019
dial_16.go Use net.DialContext on go1.7 when creating outbound connections (#541) Dec 21, 2016
dial_17.go Use net.DialContext on go1.7 when creating outbound connections (#541) Dec 21, 2016
dial_17_test.go Use net.DialContext on go1.7 when creating outbound connections (#541) Dec 21, 2016
doc.go Add tchannel documentation Oct 5, 2015
errors.go Only create Connection object for active TChannel connections (#587) Feb 24, 2017
errors_test.go relay: Avoid allocations on errors from relay Dec 21, 2016
fragmentation_test.go Fix import ordering Jun 17, 2016
fragmenting_reader.go Clarify error messages in for fragmenting reader errors (#567) Jan 19, 2017
fragmenting_writer.go Move ArgWriter interface into arguments.go Jan 13, 2016
frame.go Defer frame allocation in readFrames till we read a header (#658) Oct 31, 2017
frame_pool.go Enable SyncFramePool by default Nov 12, 2015
frame_pool_b_test.go Update glide deps, add multierr for #734 (#735) May 1, 2019
frame_pool_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
frame_test.go Defer frame allocation in readFrames till we read a header (#658) Oct 31, 2017
frame_utils_test.go Add ProtectMemFramePool which ensures frames aren't reused after Release Jun 22, 2016
glide.lock Update glide deps, add multierr for #734 (#735) May 1, 2019
glide.yaml Update glide deps, add multierr for #734 (#735) May 1, 2019
handlers.go SubChannel.SetHandler: override SubChannel Handlers Mar 1, 2016
handlers_test.go SubChannel.SetHandler: override SubChannel Handlers Mar 1, 2016
health.go Fix flaky TestHealthCheckStopBeforeStart (#660) Nov 1, 2017
health_ext_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
health_test.go Add periodic health checks to TChannel (#318) Sep 29, 2017
idle_sweep.go relay: Ensure idle sweeper also considers relay calls (#714) Aug 9, 2018
idle_sweep_test.go Fix flaky TestRaceExchangesWithClose, TestRelayBasedSweep (#738) May 2, 2019
inbound.go Expose `CallOptions` caller name for transparent proxying (#741) May 16, 2019
inbound_test.go Expose `CallOptions` caller name for transparent proxying (#741) May 16, 2019
incoming_test.go Fix import ordering Jun 17, 2016
init_test.go Consistent error logging on init handshake errors (#602) Mar 1, 2017
introspection.go relay: Fix timer release before it has stopped/completed (#740) May 6, 2019
introspection_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
largereq_test.go Fix import ordering Jun 17, 2016
localip.go ListenIP: Reduce preference for locally administered MAC addresses. (#… Jan 19, 2017
localip_test.go ListenIP: Reduce preference for locally administered MAC addresses. (#… Jan 19, 2017
logger.go nullLogger should store all fields Feb 3, 2016
logger_test.go Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
messages.go Check max string length when using WriteLenXString (#728) Feb 22, 2019
messages_test.go Fix import ordering Jun 17, 2016
messagetype_string.go go: Ping/Pong implementation. Jun 17, 2015
mex.go Update glide deps, add multierr for #734 (#735) May 1, 2019
mex_utils_test.go Introduce testutils.TestServer Mar 29, 2016
outbound.go Simplify shutdown by removing sendCh ref tracking (#727) May 1, 2019
peer.go Update glide deps, add multierr for #734 (#735) May 1, 2019
peer_bench_test.go Fix import ordering Jun 17, 2016
peer_heap.go Move threadsafe rand.Rand to a package May 4, 2016
peer_heap_test.go Update tests to avoid using unexported types Jan 15, 2016
peer_internal_test.go Treat hostPorts ending in ":0" in the init headers as ephemeral (#513) Dec 21, 2016
peer_strategies.go Isolated subchannels should not prefer incoming Dec 21, 2015
peer_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
preinit_connection.go Use string version for all addresses (#669) Nov 22, 2017
relay.go relay: Fix timer release before it has stopped/completed (#740) May 6, 2019
relay_api.go relay: Export TCP connection's RemoteAddr with calls (#719) Oct 2, 2018
relay_benchmark_test.go Fix assertion that warmup succeeded Jun 21, 2016
relay_internal_test.go relay: Fix timer release before it has stopped/completed (#740) May 6, 2019
relay_messages.go Clamp relay timeouts to a configurable max (#530) Dec 21, 2016
relay_messages_benchmark_test.go relay: Use []byte instead of string for Caller/Service/Method Jun 19, 2016
relay_messages_test.go Clamp relay timeouts to a configurable max (#530) Dec 21, 2016
relay_test.go relay: Fix timer release before it has stopped/completed (#740) May 6, 2019
relay_timer_pool.go relay: Fix timer release before it has stopped/completed (#740) May 6, 2019
reqres.go Refactor connection options propagation (#568) Jan 19, 2017
reqresreaderstate_string.go Add _string generated files (and stop ignoring them) Jun 16, 2015
reqreswriterstate_string.go Add _string generated files (and stop ignoring them) Jun 16, 2015
retry.go Only test go1.7-1.9, lint on latest (#651) Sep 26, 2017
retry_request_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
retry_test.go Small test cleanups (#551) Dec 21, 2016
retryon_string.go Add RetryIdempotent option Nov 10, 2015
root_peer_list.go Add hook for peer connection status changes (#624) May 31, 2017
stats.go Fix copyright headers in *.go files. Aug 21, 2015
stats_test.go Make stats_test less sensitive to the number of timeNow calls (#668) Nov 15, 2017
stats_utils_test.go Fix "copying lock" go vet Feb 25, 2016
stream_test.go testutils: Verify "pending" calls before connection close (#734) May 2, 2019
stress_flag_test.go Fix copyright headers in *.go files. Aug 21, 2015
subchannel.go Update the peer scores when SetStrategy is called (#583) Feb 15, 2017
subchannel_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
systemerrcode_string.go Generate string methods for SystemErrCode Nov 3, 2015
tchannel_test.go Ensure that all created channels are closed Apr 21, 2016
tracing.go Ensure outbound tracing headers take precedence (#683) Feb 23, 2018
tracing_internal_test.go Only create Connection object for active TChannel connections (#587) Feb 24, 2017
tracing_keys.go Integrate OpenTracing (#426) Aug 5, 2016
tracing_test.go Update glide deps, add multierr for #734 (#735) May 1, 2019
utils_for_test.go Add periodic health checks to TChannel (#318) Sep 29, 2017
verify_utils_test.go Pass in testing.TB to WithTestServer test function (#737) May 2, 2019
version.go Back to development May 20, 2019

README.md

TChannel GoDoc Build Status Coverage Status

TChannel is a multiplexing and framing protocol for RPC calls. tchannel-go is a Go implementation of the protocol, including client libraries for Hyperbahn.

If you'd like to start by writing a small Thrift and TChannel service, check out this guide. For a less opinionated setup, see the contribution guidelines.

Overview

TChannel is a network protocol that supports:

  • A request/response model,
  • Multiplexing multiple requests across the same TCP socket,
  • Out-of-order responses,
  • Streaming requests and responses,
  • Checksummed frames,
  • Transport of arbitrary payloads,
  • Easy implementation in many languages, and
  • Redis-like performance.

This protocol is intended to run on datacenter networks for inter-process communication.

Protocol

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

  • URI path + HTTP method and headers as JSON + body, or
  • Function name + headers + thrift/protobuf.

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

This design supports efficient routing and forwarding: routers need to parse the first or second field, but can forward the third field without parsing.

There is no notion of client and server in this system. Every TChannel instance is capable of making and receiving requests, and thus requires a unique port on which to listen. This requirement may change in the future.

See the protocol specification for more details.

Examples

  • ping: A simple ping/pong example using raw TChannel.
  • thrift: A Thrift server/client example.
  • keyvalue: A keyvalue Thrift service with separate server and client binaries.

This project is released under the [MIT License](LICENSE.md).
You can’t perform that action at this time.