Commit Graph
59 Commits
Author SHA1 Message Date
Shrutesh PachineelaandGitHub a562a3ce32 fix(build): Allow Services to be named Result (#1203)
closes #1156
2022-12-21 12:07:07 -05:00
tottotoandGitHub bf22a740c3 chore: Update to 2021 edition (#1188) 2022-12-13 15:16:49 -05:00
tottotoandGitHub 363c04a2e8 chore: Remove unused bytes from dependencies (#1186) 2022-12-13 13:06:13 -05:00
tottotoandGitHub 2dd09c02bd chore: Fix clippy lint (#1181) 2022-12-13 11:29:29 -05:00
bouzuyaandGitHub e188521149 feat(build): Add disable_comments option (#1127) 2022-11-08 11:08:19 -05:00
Lucio Franco ec359ba35f chore: Prepare 0.8 release (#1044) 2022-07-29 16:45:57 -04:00
Quentin PerezandGitHub 4388d822c4 tonic: Introduce a new method on Endpoint to override the origin (#1013) 2022-06-20 09:29:11 -04:00
Marcus GriepandGitHub a585a72293 feat!: remove codegen dependency on compression feature (#1004) 2022-06-13 17:48:27 -04:00
David PedersenandGitHub 13b55df1d0 chore: update tower-http (#985)
* Update tower-http

* one more update
2022-04-27 15:14:55 +02:00
4533a6e20e fix(build): Reduce Default bound requirement (#974)
Co-authored-by: David Pedersen <[email protected]>
2022-04-20 15:38:38 -04:00
Jesse SzwedkoandGitHub c78274e3fe feat: Update prost to 0.10 (#948) 2022-03-30 10:43:06 -04:00
Lucio FrancoandGitHub d4973642da chore: Remove MockStream (#923) 2022-02-22 16:21:39 -05:00
Lucio FrancoandGitHub a197c20469 fix(transport): connect w/ connector infailable (#922) 2022-02-22 15:33:29 -05:00
Sylwester RąpałaandGitHub c9e78c4d65 chore: Fulfill MIT license requirments (#916) 2022-02-18 13:56:47 -05:00
Anthony GreenandGitHub dee2ab52ff feat(transport): add unix socket support in server (#861) 2022-02-14 15:00:58 -05:00
tottotoandGitHub f58fda42a9 chore(tests): Update tower-http to 0.2 (#878) 2022-01-12 16:34:59 -05:00
tottotoandGitHub 366d888a4b chore: Fix clippy lints (#881) 2022-01-12 16:32:40 -05:00
tottotoandGitHub daf406dd2b chore: Update tracing-subscriber to 0.3 (#873) 2021-12-30 09:53:02 +01:00
David PedersenandGitHub 101f2f76d4 chore: revert to 2018 edition (#847)
Fixes https://github.com/hyperium/tonic/issues/843
2021-12-07 09:49:07 +01:00
Lucio FrancoandGitHub 23c1392fb7 fix(tonic): Remove Sync requirement for streams (#804) 2021-10-24 21:48:05 -04:00
Lucio FrancoandGitHub 1f3df8db9e chore: Upgrade to 2021 edition (#808) 2021-10-24 21:12:20 -04:00
Tom DyasandGitHub ff6a690cec fix(build): Correctly convert Empty to () (#734) 2021-10-22 08:44:27 -04:00
4947b076f5 fix(transport): Correctly map hyper errors (#629)
Co-authored-by: Lucio Franco <[email protected]>
2021-10-20 11:05:27 -04:00
2e471548d8 fix(tonic): change connect_lazy to be infallible (#712)
Co-authored-by: Lucio Franco <[email protected]>
2021-10-20 10:47:17 -04:00
88008191fc compression: handle compression flag but no header (#763)
Co-authored-by: Quentin Perez <[email protected]>
Co-authored-by: Lucio Franco <[email protected]>
2021-10-20 10:02:52 -04:00
Lucio FrancoandGitHub 4054d61e14 fix(tonic): Status code to set correct source on unkown error (#799) 2021-10-19 11:52:59 -04:00
Eliza WeismanandGitHub 09805ece45 feat: Update prost and friends to 0.9 (#791) 2021-10-19 10:59:28 -04:00
David PedersenandGitHub 380d81dd86 fix(build): allow services to be named Service (#709)
Fixes https://github.com/hyperium/tonic/issues/676
2021-07-12 16:47:45 +02:00
David PedersenandGitHub acdb3273bb chore: update prost, and related crates, to 0.8 (#703)
* chore: update prost, and related crates, to 0.8

Updates prost, prost-derive, prost-build, and prost-types to 0.8.

* Update the last few places
2021-07-08 15:02:02 -04:00
Lucio FrancoandGitHub 2346d99f6e example: Add mocked io example (#677)
* example: Add mocked io example

* fix mock example

* Remove uniex bound for mock impl
2021-07-08 10:45:04 -04:00
David PedersenandGitHub 0583cff80f feat(codec): compression support (#692)
* Initial compression support

* Support configuring compression on `Server`

* Minor clean up

* Test that compression is actually happening

* Clean up some todos

* channels compressing requests

* Move compression to be on the codecs

* Test sending compressed request to server that doesn't support it

* Clean up a bit

* Compress server streams

* Compress client streams

* Bidirectional streaming compression

* Handle receiving unsupported encoding

* Clean up

* Add note to future self

* Support disabling compression for individual responses

* Add docs

* Add compression examples

* Disable compression behind feature flag

* Add some docs

* Make flate2 optional dependency

* Fix docs wording

* Format

* Reply with which encodings are supported

* Convert tests to use mocked io

* Fix lints

* Use separate counters

* Don't make a long stream

* Address review feedback
2021-07-02 11:25:03 -04:00
Lucio FrancoandGitHub 737ace393d fix(codec): Fix streaming reponses w/ many status (#689)
Closes #681
2021-07-01 10:25:43 -04:00
David PedersenandGitHub e82f0b0399 build: generate root crate paths correctly (#623)
We shouldn't append `proto_path` (`super` by default) if the path starts
with `crate::`.

Fixes https://github.com/hyperium/tonic/issues/548
2021-06-02 16:58:43 +02:00
David PedersenandGitHub e5e311853b feat(transport): provide generic access to connect info (#647) 2021-05-28 13:27:37 +02:00
David PedersenandGitHub 4d2667d1cb feat(tonic): make it easier to add tower middleware to servers (#651) 2021-05-19 09:19:58 +02:00
David PedersenandGitHub 352b0f584b feat(tonic): add Request and Response extensions (#642)
Adds `tonic::Extensions` which is a newtype around `http::Extensions`.

Request extensions can be set by interceptors with
`Request::extensions_mut` and retrieved from RPCs with
`Request::extensions`. Extensions can also be set in tower middleware
and will be carried through to the RPC.

Since response extensions cannot be set by interceptors the main use
case is to set them in RPCs and retrieve them in tower middlewares.
Figured that might be useful.

Fixes https://github.com/hyperium/tonic/issues/255
2021-05-13 15:54:20 +02:00
9ff4f7b8e4 feat(transport): Support timeouts with "grpc-timeout" header (#606)
* transport: Support timeouts with "grpc-timeout" header

* Apply suggestions from code review

Co-authored-by: Lucio Franco <[email protected]>

* Timeout -> GrpcTimeout and export TimeoutExpired

* Clean up imports

* Give header name a more proper home

* Add fuzz tests for parsing header value into `grpc-timeout`

* Map `TimeoutExpired` to `cancelled` status

* Recover from timeout errors in the service

* Refactor tests

* Fix CI

* Fix CI, again

Co-authored-by: Lucio Franco <[email protected]>
2021-04-29 10:28:16 +02:00
Ben SullyandGitHub 6c898a239f Use fully qualified path for futures_core::Stream in codegen (#591) 2021-03-28 19:31:20 +02:00
Tom DyasandGitHub 61555ff2b5 feat(build): Support compiling well-known protobuf types (#522) 2021-02-23 16:21:03 -05:00
fdda5ae26a Upgrade to Tokio 1.0.0 ecosystem (#530)
* Upgrade Tonic to Tokio 1.0

Work in progress for updating Tonic to Tokio 1.0. Since tower has not
been released to crates.io, a git dependency is taken instead.

* Upgrade Tonic to Tokio 1.0 phase 2

* tonic: remove tower-* deps

* Apply suggestions from code review

Co-authored-by: Ed Marshall <[email protected]>
Co-authored-by: Lucio Franco <[email protected]>
2021-01-11 12:18:34 -05:00
Juan AlvarezandGitHub d4899df832 feat(transport): add user-agent header to client requests. (#457)
* Add a default user-agent header to outgoing requests.
* The user agent can be configured through the `Channel` builder.

fixes #453
2020-09-23 18:58:03 -05:00
Juan AlvarezandGitHub e9910d10a7 fix(transport): reconnect lazy connections after first failure (#458)
* fix(transport): reconnect lazy connections after first failure

Channels created with lazy connections never try to reconnect if the
first connection attempt fails. This is because `Reconnect` returns
`Poll::Ready(Err)` on poll_ready and the service is considered dead.

This change passes a flag to Reconnect to signal if the connection
is intended to be lazy, in which case reconnect returns the error on
the next call.

fixes #452
2020-09-23 09:35:42 -05:00
Lucio FrancoandGitHub 2ea17b2ecf fix(transport): Return connection error on Channel::connect (#413)
Before this fix, if the connect phase of the transport failed before
ever establishing a connection, we would never return the error until
the first call to send a request. This PR changes that behavior to only
forward the error to the call method if we have ever made a connection
before. If we have never established a connection before then
`Reconnect` will return an error on the call to `poll_ready`.

Fixes #403
2020-07-27 12:44:11 -04:00
Dmitry ShuranovandGitHub 372da52e96 feat: Add metadata to error responses (#348) 2020-05-10 11:46:45 -04:00
Lucio FrancoandGitHub e683ffef1f fix: base64 encode details header (#345) 2020-05-07 15:31:26 -04:00
Yonathan RandolphandGitHub 5d56daa721 fix(build): Remove ambiguity in service method call (#327)
When calling methods on Arc<MyService> where the method is also defined on Arc (e.g. drop and clone), calling inner.#method_ident(request) will actually attempt to call the Arc method instead of the method on the service, resulting in a compile error. This change removes the ambiguity by dereferencing the inner Arc.
2020-04-09 13:40:26 -04:00
Lucio FrancoandGitHub e5b1f8a172 chore: Rename internal uuid crate (#319)
Signed-off-by: Lucio Franco <[email protected]>
2020-04-01 12:35:11 -04:00
Lucio FrancoandGitHub 2e082f8b3e chore(build): Refactor codegen traits (#302)
Signed-off-by: Lucio Franco <[email protected]>
2020-03-29 12:57:11 -04:00
Gyusun YeomandGitHub f65cda1ea0 feat(build): Decouple codgen from prost (#170) 2020-03-01 13:52:31 -05:00
Danny HuaandGitHub 1b3d107206 fix(build): Don't replace extern_paths (#261)
* don't replace extern_path'd paths

tonic-build will replace all paths except for google well known types
with one rooted at the super module. For paths that have already been
replaced with a fully qualified path via the extern_path config option,
(e.g. "::uuid::Uuid"), this results in an invalid path
(e.g. "super::::uuid::Uuid"), and a build failure. These paths should
also be excluded when prefixing relative modules with super.

* add doc in tonic-build clarifying extern_path

extern_path expects fully qualified proto and rust paths

* add test cast case for extern path fix

add a test that extern path does indeed result in service types using
the specified type from an external crate. we test this by creating a
service type that has a proto from a different crate, and asserting that
it does indeed impl a trait from that crate

* add license/publish to extern_path test crates
2020-02-18 09:56:32 -05:00