grpc / grpc/grpc-rust

What's the idiomatic way of passing data from a layer to the actual service implementation?

Open
#839 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

I'm looking at this example where you use a tower layer to do some async processing before a request (in my case I want to check if a use is authenticated).

However, one problem I'm facing with the tower layer is that _I don't know how to pass the result to the Service. In the example below, you can do some 'extra work', but you just pass the request further up the stack of layers. For instance, I want to be able to pass a user ID up the stack.

https://github.com/hyperium/tonic/blob/master/examples/src/tower/server.rs#L105

In the above example, you pass a `hyper::Request`, which doesn't really have anyway of attaching metadata (beyond something silly like adding it to the headers).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.