Support interior mutability in prost-reflection
- 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
Assessment
This issue has not been assessed yet.