grpc / grpc/grpc-rust

Support interior mutability in prost-reflection

Open
#1,328 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

## Feature Request

Enable interior mutability within `ReflectionService` to enable to dynamically register/deregister services.

### Crates

`prost-reflection`

### Motivation

I have a use case where I use some tonic components to proxy between grpc services. I would like to reuse `prost-reflection` to implement grpc reflections, but I lack the ability to dinamically register/deregister services.

### Proposal

I wonder if it would be possible to change the state of `ReflectionService` to something like `Arc>` or similar, and then expose some handle to this state to mutate it from somewhere else. This handle should have methods such as add service/remove service. WDYT?

### Alternatives

Right now I'm left with 2 alternatives:

* Manually wrap the whole service in an Arc and replace the full instance at once everytime there is a service change. Might be problematic when dealing with a reasonably large number of services, as this requires me to reinitialize `ReflectionService` every time
* Not use `prost-reflection`, and build everything on my own.

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.