1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

bitbake: hashserv: Add db-usage API

Adds an API to query the server for the usage of the database (e.g. how
many rows are present in each table)

(Bitbake rev: c9c1224447e147e0de92953bc85cea75670b898c)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Watt
2023-11-03 08:26:33 -06:00
committed by Richard Purdie
parent 8cfb94c06c
commit 3a2c5a6fa2
6 changed files with 86 additions and 0 deletions
+5
View File
@@ -249,6 +249,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection):
"get-outhash": self.handle_get_outhash,
"get-stream": self.handle_get_stream,
"get-stats": self.handle_get_stats,
"get-db-usage": self.handle_get_db_usage,
# Not always read-only, but internally checks if the server is
# read-only
"report": self.handle_report,
@@ -567,6 +568,10 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection):
oldest = datetime.now() - timedelta(seconds=-max_age)
return {"count": await self.db.clean_unused(oldest)}
@permissions(DB_ADMIN_PERM)
async def handle_get_db_usage(self, request):
return {"usage": await self.db.get_usage()}
# The authentication API is always allowed
async def handle_auth(self, request):
username = str(request["username"])