Implement API to manage indexing queues #437
Labels
next-sprint
Scheduled for work (CERT.PL internal)
type:feature
Add a new feature
zone:backend
Backend oriented tasks
Milestone
We plan to implement an automated file indexing in the future.
Right now (after #434), there is a database object representing indexed files, but there's no way to manipulate them - add files, remove them, etc.
In this issue I propose to add three endpoints to mquery:
POST /api/queue/{ursadb_id}
Takes a JSON body with a list of file paths on the ursadb server to be indexed.
For example, POST to
/api/queue/default
with["/mnt/samples/12345"]
will tell ursadb with IDdefault
that a file/mnt/samples/12345
should be indexed.This endpoint should support all QueuedFile fields, i.e. tags and index types, etc.
JSON body can look like this:
or:
whichever is easier to implement.
GET /api/queue/{ursadb_id}
Returns a JSON with enough information to show the queue status in the admin panel. Probably for now this should be just something like:
POST /api/queue/{ursadb_id}/clear
Or just
DELETE /api/queue/{name}
if you're feeling RESTy - to be decided by implementer.Takes no parameters, and removes all files from the specified queue (i.e. removes all
QueuedFile
s with the given ursadb_id from the database).Finally, all endpoints must be hidden behind appropriate permissions. We need two new user roles:
can_view_queues
andcan_manage_queues
. I think every user should be able to see queue status, and admin should be able to manage them by default. Add the permissions to the groups by default (seeexpand_role
function).This should most likely be implemented more than one PR, to avoid one huge PR
The text was updated successfully, but these errors were encountered: