diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2023-11-03 08:26:33 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-09 17:33:03 +0000 |
commit | 3a2c5a6fa2e0081c28d5f2f43e1d9a79d093ea37 (patch) | |
tree | f596b84a7295cd8421fcee447a10e2c082b94c72 /bitbake/lib/hashserv/server.py | |
parent | 8cfb94c06cdfe3e6f0ec1ce0154951108bc3df94 (diff) | |
download | poky-3a2c5a6fa2e0081c28d5f2f43e1d9a79d093ea37.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/hashserv/server.py')
-rw-r--r-- | bitbake/lib/hashserv/server.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py index ca419a1abf..c5b9797e4e 100644 --- a/bitbake/lib/hashserv/server.py +++ b/bitbake/lib/hashserv/server.py | |||
@@ -249,6 +249,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): | |||
249 | "get-outhash": self.handle_get_outhash, | 249 | "get-outhash": self.handle_get_outhash, |
250 | "get-stream": self.handle_get_stream, | 250 | "get-stream": self.handle_get_stream, |
251 | "get-stats": self.handle_get_stats, | 251 | "get-stats": self.handle_get_stats, |
252 | "get-db-usage": self.handle_get_db_usage, | ||
252 | # Not always read-only, but internally checks if the server is | 253 | # Not always read-only, but internally checks if the server is |
253 | # read-only | 254 | # read-only |
254 | "report": self.handle_report, | 255 | "report": self.handle_report, |
@@ -567,6 +568,10 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): | |||
567 | oldest = datetime.now() - timedelta(seconds=-max_age) | 568 | oldest = datetime.now() - timedelta(seconds=-max_age) |
568 | return {"count": await self.db.clean_unused(oldest)} | 569 | return {"count": await self.db.clean_unused(oldest)} |
569 | 570 | ||
571 | @permissions(DB_ADMIN_PERM) | ||
572 | async def handle_get_db_usage(self, request): | ||
573 | return {"usage": await self.db.get_usage()} | ||
574 | |||
570 | # The authentication API is always allowed | 575 | # The authentication API is always allowed |
571 | async def handle_auth(self, request): | 576 | async def handle_auth(self, request): |
572 | username = str(request["username"]) | 577 | username = str(request["username"]) |