From c1574ae46f7a5701d79f2c1d333094a5d5919a46 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Fri, 3 Nov 2023 08:26:34 -0600 Subject: bitbake: hashserv: Add database column query API Adds an API to retrieve the columns that can be queried on from the database backend. This prevents front end applications from needing to hardcode the query columns (Bitbake rev: abfce2b68bdab02ea2e9a63fbb3b9e270428a0a6) Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- bitbake/lib/hashserv/server.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bitbake/lib/hashserv/server.py') diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py index c5b9797e4e..8c3d20b651 100644 --- a/bitbake/lib/hashserv/server.py +++ b/bitbake/lib/hashserv/server.py @@ -250,6 +250,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): "get-stream": self.handle_get_stream, "get-stats": self.handle_get_stats, "get-db-usage": self.handle_get_db_usage, + "get-db-query-columns": self.handle_get_db_query_columns, # Not always read-only, but internally checks if the server is # read-only "report": self.handle_report, @@ -572,6 +573,10 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): async def handle_get_db_usage(self, request): return {"usage": await self.db.get_usage()} + @permissions(DB_ADMIN_PERM) + async def handle_get_db_query_columns(self, request): + return {"columns": await self.db.get_query_columns()} + # The authentication API is always allowed async def handle_auth(self, request): username = str(request["username"]) -- cgit v1.2.3-54-g00ecf