Commit Graph

32 Commits

Author SHA1 Message Date
Shrutesh Pachineela a562a3ce32 fix(build): Allow Services to be named Result (#1203)
closes #1156
2022-12-21 12:07:07 -05:00
bouzuya e188521149 feat(build): Add disable_comments option (#1127) 2022-11-08 11:08:19 -05:00
LIU JIE c9cadd4b23 chore: remove patch caused cargo error (#1140) 2022-11-08 10:17:54 -05:00
Lucio Franco 1f5bc9b9d5 feat(build): Add build_transport builder option (#1130) 2022-11-04 11:04:23 -04:00
Lucio Franco 23c1392fb7 fix(tonic): Remove Sync requirement for streams (#804) 2021-10-24 21:48:05 -04:00
David Pedersen 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 Pedersen 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
Juan Alvarez 8084f4ea26 chore(tonic-web): include crate in top-level workspace (#648)
This PR adds the tonic-web crate to tonic's workspace members. 
Unit and integration tests should now run as part of CI runs.
2021-06-03 11:48:53 -05:00
David Pedersen 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
Ben Sully 6c898a239f Use fully qualified path for futures_core::Stream in codegen (#591) 2021-03-28 19:31:20 +02:00
Tom Dyas 61555ff2b5 feat(build): Support compiling well-known protobuf types (#522) 2021-02-23 16:21:03 -05:00
James Nugent c54f24721c feat: Implement gRPC Reflection Service (#340)
Co-authored-by: Samani G. Gikandi <samani@gojulas.com>
2021-02-16 11:07:51 -05:00
Lucio Franco ea7fe66b14 feat(types): Add tonic-types crate (#391) 2020-07-08 18:01:16 -04:00
Lucio Franco e683ffef1f fix: base64 encode details header (#345) 2020-05-07 15:31:26 -04:00
Yonathan Randolph 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
James Nugent da92dbf8aa feat(health): Add tonic-health server impl
This commit adds a new crate `tonic-health` which implements the
[standard GRPC Health Checking][checking] protocol.

Currently there is only a server implementation, though others have
alluded in the discussion in #135 that client implementations exist
which could also be imported as necessary.

A example server has also been added - once the client work is done a
client for this should be added also.

[checking]: https://github.com/grpc/grpc/blob/master/doc/health-checking.md

Fixes #135.
2020-03-30 09:33:02 -05:00
Danny Hua 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
Lucio Franco eba7ec7b32 feat: Add gRPC interceptors (#232)
This change introduces proper gRPC interceptors that are avilable
regardless of the transport used. Each codegen service now produces an
additional method called `with_interceptor` that accepts a
`Interceptor`.

All examples have been updated to use this new style and interop has a
custom `tower::Service` middleware to echo the headers. There is also a
new `interceptor` example that shows basic usage.

BREAKING CHANGE: removed `interceptor_fn` and `intercep_headers_fn` from `transport` in favor of using `tonic::Interceptor`.
2020-01-13 21:26:08 -05:00
Lucio Franco d9a481baef chore: Reorganize examples and interop crates (#180)
* chore: Reorganize examples and interop crates

* fix interop tests
2019-12-12 11:53:15 -05:00
Juan Alvarez 6b43f63578 remove tower cargo patches (#164) 2019-12-06 12:23:37 -05:00
Lucio Franco 3387ef900f Upgrade to tokio 0.2 (#163) 2019-12-06 00:09:46 -05:00
James Steele b02b4b238b fix(build): Prevent duplicated client/server generated code (#121)
* fix(build): Prevent duplicated client/server generated code

The tonic-build process collects up RPC services as they are provided by
prost, before writing them out as part of the finalization step for a
given protocol buffer package.

In the case of imported protocol buffer packages, there may be RPC
services included by import in addition to those in the top-level
package. Therefore it is necessary to make sure each set of
client/server services gathered by tonic-build is cleared after the
finalization process for a given protocol buffer package, otherwise they
will be incorrectly aggregated as the generation process proceeds
through the subsequent packages.

* Test case for duplicated client/server generated code

A simple test case that will fail to build without a fix to prevent
RPC services being duplicated into inappropriate modules (that related
to particular protocol buffer packages).

* Additional test case for included_service

Introduces an additional case that captures making sure services defined
before including a package with additional services doesn't
incidentially clear such precursor services from the including package.

* Fix unnecessary newline to keep `cargo fmt` happy
2019-11-09 15:45:22 +00:00
Lucio Franco 1dbde95d84 fix(build): Fix service and rpc name conflict (#92)
Closes #89
2019-10-23 15:01:04 -04:00
Lucio Franco ec5778dfa1 Update interop server 2019-09-06 15:37:08 -04:00
Lucio Franco d0cfafafc6 Move codegen to build and remove macros 2019-09-06 15:19:18 -04:00
Lucio Franco 295e7321b9 Add first step of async-trait 2019-09-06 01:30:51 -04:00
Lucio Franco f750dfa111 Fix interoptests and rewrite decode 2019-08-28 17:24:53 -04:00
Lucio Franco 8dc1185a36 Add first pass at interop tests 2019-08-18 21:04:00 -04:00
Lucio Franco 5e208d9da2 First pass at macro 2019-08-15 17:50:25 -04:00
Lucio Franco 0a8aaa8071 Clean up main crate and more work on macro
Signed-off-by: Lucio Franco <luciofranco14@gmail.com>
2019-08-15 15:09:54 -04:00
Lucio Franco 404f7d8931 Add tower-h2 and more macro 2019-08-11 13:48:13 -04:00
Lucio Franco b827fdd950 Inital commit 2019-08-09 14:01:27 -04:00