diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2024-02-18 15:59:48 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-19 11:58:12 +0000 |
commit | 3bd2c69e70853584beaaa5a4fd62589fa051d911 (patch) | |
tree | 3dc6469a1895cc7a31a58e4fc9dc43cef9a82cfb /bitbake/bin | |
parent | be909636c608d5ba24a41327c53d6a4ba3b70151 (diff) | |
download | poky-3bd2c69e70853584beaaa5a4fd62589fa051d911.tar.gz |
bitbake: hashserv: Add unihash-exists API
Adds API to check if the server is aware of the existence of a given
unihash. This can be used as an optimization for sstate where a client
can query the hash equivalence server to check if a unihash exists
before querying the sstate cache. If the hash server isn't aware of the
existence of a unihash, then there is very likely not a matching sstate
object, so this should be able to significantly cut down on the number
of negative hits on the sstate cache.
(Bitbake rev: cfe0ac071cfb998e4a1dd263f8860b140843361a)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-x | bitbake/bin/bitbake-hashclient | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient index f71b87404a..47dd27cd3c 100755 --- a/bitbake/bin/bitbake-hashclient +++ b/bitbake/bin/bitbake-hashclient | |||
@@ -217,6 +217,14 @@ def main(): | |||
217 | print("Removed %d rows" % result["count"]) | 217 | print("Removed %d rows" % result["count"]) |
218 | return 0 | 218 | return 0 |
219 | 219 | ||
220 | def handle_unihash_exists(args, client): | ||
221 | result = client.unihash_exists(args.unihash) | ||
222 | if args.quiet: | ||
223 | return 0 if result else 1 | ||
224 | |||
225 | print("true" if result else "false") | ||
226 | return 0 | ||
227 | |||
220 | parser = argparse.ArgumentParser(description='Hash Equivalence Client') | 228 | parser = argparse.ArgumentParser(description='Hash Equivalence Client') |
221 | parser.add_argument('--address', default=DEFAULT_ADDRESS, help='Server address (default "%(default)s")') | 229 | parser.add_argument('--address', default=DEFAULT_ADDRESS, help='Server address (default "%(default)s")') |
222 | parser.add_argument('--log', default='WARNING', help='Set logging level') | 230 | parser.add_argument('--log', default='WARNING', help='Set logging level') |
@@ -309,6 +317,11 @@ def main(): | |||
309 | gc_sweep_parser.add_argument("mark", help="Mark for this garbage collection operation") | 317 | gc_sweep_parser.add_argument("mark", help="Mark for this garbage collection operation") |
310 | gc_sweep_parser.set_defaults(func=handle_gc_sweep) | 318 | gc_sweep_parser.set_defaults(func=handle_gc_sweep) |
311 | 319 | ||
320 | unihash_exists_parser = subparsers.add_parser('unihash-exists', help="Check if a unihash is known to the server") | ||
321 | unihash_exists_parser.add_argument("--quiet", action="store_true", help="Don't print status. Instead, exit with 0 if unihash exists and 1 if it does not") | ||
322 | unihash_exists_parser.add_argument("unihash", help="Unihash to check") | ||
323 | unihash_exists_parser.set_defaults(func=handle_unihash_exists) | ||
324 | |||
312 | args = parser.parse_args() | 325 | args = parser.parse_args() |
313 | 326 | ||
314 | logger = logging.getLogger('hashserv') | 327 | logger = logging.getLogger('hashserv') |