aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hashserv/client.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2023-11-03 08:26:33 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-09 17:21:15 +0000
commitc9c1224447e147e0de92953bc85cea75670b898c (patch)
treedde05ce0a1b1c17bcad5830f39ed52090f53b435 /lib/hashserv/client.py
parent71e2f5b52b686f34df364ae1f2fc058f45cd5e18 (diff)
downloadbitbake-c9c1224447e147e0de92953bc85cea75670b898c.tar.gz
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) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/hashserv/client.py')
-rw-r--r--lib/hashserv/client.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/hashserv/client.py b/lib/hashserv/client.py
index 4457f8e50..5e0a462b1 100644
--- a/lib/hashserv/client.py
+++ b/lib/hashserv/client.py
@@ -186,6 +186,10 @@ class AsyncClient(bb.asyncrpc.AsyncClient):
self.saved_become_user = username
return result
+ async def get_db_usage(self):
+ await self._set_mode(self.MODE_NORMAL)
+ return (await self.invoke({"get-db-usage": {}}))["usage"]
+
class Client(bb.asyncrpc.Client):
def __init__(self, username=None, password=None):
@@ -214,6 +218,7 @@ class Client(bb.asyncrpc.Client):
"new_user",
"delete_user",
"become_user",
+ "get_db_usage",
)
def _get_async_client(self):