summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/hashserv/client.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2024-02-18 15:59:46 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-19 11:58:12 +0000
commit1effd1014d9140905093efe25eeefedb28a10875 (patch)
treeb34fb1d26f020b361d22904695cab6b9a7c1ea50 /bitbake/lib/hashserv/client.py
parent324c9fd666117afb0dd689eaa8551bb02d6a042b (diff)
downloadpoky-1effd1014d9140905093efe25eeefedb28a10875.tar.gz
bitbake: hashserv: Add Unihash Garbage Collection
Adds support for removing unused unihashes from the database. This is done using a "mark and sweep" style of garbage collection where a collection is started by marking which unihashes should be kept in the database, then performing a sweep to remove any unmarked hashes. (Bitbake rev: 433d4a075a1acfbd2a2913061739353a84bb01ed) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/client.py')
-rw-r--r--bitbake/lib/hashserv/client.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/client.py b/bitbake/lib/hashserv/client.py
index 35a97687fb..e6dc417912 100644
--- a/bitbake/lib/hashserv/client.py
+++ b/bitbake/lib/hashserv/client.py
@@ -194,6 +194,34 @@ class AsyncClient(bb.asyncrpc.AsyncClient):
194 await self._set_mode(self.MODE_NORMAL) 194 await self._set_mode(self.MODE_NORMAL)
195 return (await self.invoke({"get-db-query-columns": {}}))["columns"] 195 return (await self.invoke({"get-db-query-columns": {}}))["columns"]
196 196
197 async def gc_status(self):
198 await self._set_mode(self.MODE_NORMAL)
199 return await self.invoke({"gc-status": {}})
200
201 async def gc_mark(self, mark, where):
202 """
203 Starts a new garbage collection operation identified by "mark". If
204 garbage collection is already in progress with "mark", the collection
205 is continued.
206
207 All unihash entries that match the "where" clause are marked to be
208 kept. In addition, any new entries added to the database after this
209 command will be automatically marked with "mark"
210 """
211 await self._set_mode(self.MODE_NORMAL)
212 return await self.invoke({"gc-mark": {"mark": mark, "where": where}})
213
214 async def gc_sweep(self, mark):
215 """
216 Finishes garbage collection for "mark". All unihash entries that have
217 not been marked will be deleted.
218
219 It is recommended to clean unused outhash entries after running this to
220 cleanup any dangling outhashes
221 """
222 await self._set_mode(self.MODE_NORMAL)
223 return await self.invoke({"gc-sweep": {"mark": mark}})
224
197 225
198class Client(bb.asyncrpc.Client): 226class Client(bb.asyncrpc.Client):
199 def __init__(self, username=None, password=None): 227 def __init__(self, username=None, password=None):
@@ -224,6 +252,9 @@ class Client(bb.asyncrpc.Client):
224 "become_user", 252 "become_user",
225 "get_db_usage", 253 "get_db_usage",
226 "get_db_query_columns", 254 "get_db_query_columns",
255 "gc_status",
256 "gc_mark",
257 "gc_sweep",
227 ) 258 )
228 259
229 def _get_async_client(self): 260 def _get_async_client(self):