aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2024-02-18 15:59:48 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-19 11:53:15 +0000
commitcfe0ac071cfb998e4a1dd263f8860b140843361a (patch)
tree5baa4f4eeafc8816ecceba2a55f8d8eadeb7bcd1 /bin
parent0409a00d62f45afb1b172acbcea17bf17942e846 (diff)
downloadbitbake-cfe0ac071cfb998e4a1dd263f8860b140843361a.tar.gz
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. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bitbake-hashclient13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/bitbake-hashclient b/bin/bitbake-hashclient
index f71b87404..47dd27cd3 100755
--- a/bin/bitbake-hashclient
+++ b/bin/bitbake-hashclient
@@ -217,6 +217,14 @@ def main():
print("Removed %d rows" % result["count"])
return 0
+ def handle_unihash_exists(args, client):
+ result = client.unihash_exists(args.unihash)
+ if args.quiet:
+ return 0 if result else 1
+
+ print("true" if result else "false")
+ return 0
+
parser = argparse.ArgumentParser(description='Hash Equivalence Client')
parser.add_argument('--address', default=DEFAULT_ADDRESS, help='Server address (default "%(default)s")')
parser.add_argument('--log', default='WARNING', help='Set logging level')
@@ -309,6 +317,11 @@ def main():
gc_sweep_parser.add_argument("mark", help="Mark for this garbage collection operation")
gc_sweep_parser.set_defaults(func=handle_gc_sweep)
+ unihash_exists_parser = subparsers.add_parser('unihash-exists', help="Check if a unihash is known to the server")
+ 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")
+ unihash_exists_parser.add_argument("unihash", help="Unihash to check")
+ unihash_exists_parser.set_defaults(func=handle_unihash_exists)
+
args = parser.parse_args()
logger = logging.getLogger('hashserv')