aw-server-rust
aw-server-rust copied to clipboard
DELETE endpoint to delete event(s)
My suggested API:
- Remove
DELETE <bucketname>/events/<id>
endpoint - Add
POST <bucketname>/events/delete/by_ids
- Add
GET <bucketname>/events/delete/by_period?start=X&end=X
Reasons why the old delete API is bad and should be replaced completely:
- The new "by_ids" endpoint makes it possible to remove multiple specific events in one go while the old API could only delete one event at a time.
- The old DELETE endpoint is also broken because both
/events/<id>
and/events/count
are in the same namespace
Things which need to be considered:
- Vacuuming the database
Resources:
- Discussion with @leoschwarz in aw-server-python PR https://github.com/ActivityWatch/aw-server/pull/57
We should keep in mind that we might want to use the pragma secure_delete
or run a VACUUM
to ensure secure deletion of data.
Maybe run VACUUM when aw-server is starting up? Seems like a sane time to do it.
secure_delete=FAST seems like the best approach for us I believe.
Maybe run VACUUM when aw-server is starting up? Seems like a sane time to do it.
If the operation is somewhat costly then I'd rather not as that could slow down the startup time of the Android app (less of a concern on desktop, where the user is unlikely to use ActivityWatch the moment it's started).
If the operation is somewhat costly then I'd rather not as that could slow down the startup time of the Android app (less of a concern on desktop, where the user is unlikely to use ActivityWatch the moment it's started).
Hm, I guess that's true.
A solution would be to have it as both an API endpoint to manually start a VACUUM as well as maybe store the last time a VACUUM was performed and do it once every X months.
So the delete endpoint for a single event just as for aw-server-python is now implemented but there is no VACUUM for now. Maybe we should have a new issue for VACUUM?
Updated the issue body