ankicommunity / anki-sync-server-rs

A personal custom Anki sync server,aim to provide an easier way for deployment
GNU Affero General Public License v3.0
180 stars 27 forks source link

Use in memory database to manage sessions #36

Closed redmie closed 2 years ago

redmie commented 2 years ago

Sessions do not need to survive server restart. As such there is no need to keep them on disk (it's actually bad for both security and performance).

We should investigate the use of an in memory database for sessions.

Maybe something as simple as a rust HashMap would be sufficient, maybe we need something more powerful like sled.

What are your thoughts on the subject @dobefore ?

dobefore commented 2 years ago

Thanks for the suggestion! It's possible to implement while seeing the anki lib where that there is no database ops .

I'll take this,I

dobefore commented 2 years ago

I think I am wrong.Unfortunately there are still some conditions in which we have to rely on session on server restart.

We have to determine which user we are serving and that is only can be retrived from session database.And we query username from session database by k or sk from clent request (After authentication success,client send k or sk instead of username).

Once we get username,then we can determine the corresponding collcection path.

Add:#45