aw-server-rust icon indicating copy to clipboard operation
aw-server-rust copied to clipboard

DELETE endpoint to delete event(s)

Open johan-bjareholt opened this issue 4 years ago • 7 comments

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

johan-bjareholt avatar Aug 27 '19 19:08 johan-bjareholt

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.

ErikBjare avatar Aug 28 '19 11:08 ErikBjare

Maybe run VACUUM when aw-server is starting up? Seems like a sane time to do it.

johan-bjareholt avatar Aug 28 '19 12:08 johan-bjareholt

secure_delete=FAST seems like the best approach for us I believe.

johan-bjareholt avatar Aug 28 '19 12:08 johan-bjareholt

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).

ErikBjare avatar Aug 28 '19 12:08 ErikBjare

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.

johan-bjareholt avatar Aug 28 '19 14:08 johan-bjareholt

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?

johan-bjareholt avatar Jan 14 '20 20:01 johan-bjareholt

Updated the issue body

johan-bjareholt avatar Apr 05 '20 12:04 johan-bjareholt