Skip to content

Tower service that can monitor if a Tonic request frame was produced prior to error.

License

Notifications You must be signed in to change notification settings

s2-streamstore/tonic-side-effect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tonic-side-effect

This crate provides a tower service for wrapping a tonic Channel, which monitors if a request Body ever produced a frame before returning an error.

The service communicates whether poll_frame on the request ever produced data, via a handle to shared state.

Why might this be helpful?

It can be useful, when building systems that need to carefully consider potential side-effects from RPCs, to disambiguate between failures which occurred strictly before any data from a request could possibly have been read (as might be the case for a connection refused or DNS error), and failures which occurred after request data may have been consumed (e.g. a connection reset).

A tonic Status represents the mapping of many types of underlying failures into gRPC status, and it's not possible to make hard guarantees about whether any request content was transmitted or not simply by considering the status code.

This service provides more direct access to a boundary that is of particular interest for purposes of reasoning about RPC side-effects (and in a safer way than rooting around in the status' error source chain).

About

Tower service that can monitor if a Tonic request frame was produced prior to error.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages