khonsulabs / bonsaidb

A developer-friendly document database that grows with you, written in Rust
https://bonsaidb.io/
Apache License 2.0
998 stars 37 forks source link

`Backend` should be notified when a session ends #270

Closed ecton closed 1 year ago

ecton commented 1 year ago

While working on a server, I realized I had no way to notice when a Session ends, only when a connection is fully dropped. The Backend trait should have a function that gets called whenever a session is dropped, but the connection is still active.

I'm not sure at this time whether the function should be called for each session when the client disconnects. With #269, the need is somewhat alleviated. Regardless of the path picked, the documentation should be clear whether this new function is called during disconnection or just when a session ends on a still-alive connection.