diff options
Diffstat (limited to 'bitbake/bin/bitbake-hashclient')
| -rwxr-xr-x | bitbake/bin/bitbake-hashclient | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient index 2cb6338666..f71b87404a 100755 --- a/bitbake/bin/bitbake-hashclient +++ b/bitbake/bin/bitbake-hashclient | |||
| @@ -195,6 +195,28 @@ def main(): | |||
| 195 | columns = client.get_db_query_columns() | 195 | columns = client.get_db_query_columns() |
| 196 | print("\n".join(sorted(columns))) | 196 | print("\n".join(sorted(columns))) |
| 197 | 197 | ||
| 198 | def handle_gc_status(args, client): | ||
| 199 | result = client.gc_status() | ||
| 200 | if not result["mark"]: | ||
| 201 | print("No Garbage collection in progress") | ||
| 202 | return 0 | ||
| 203 | |||
| 204 | print("Current Mark: %s" % result["mark"]) | ||
| 205 | print("Total hashes to keep: %d" % result["keep"]) | ||
| 206 | print("Total hashes to remove: %s" % result["remove"]) | ||
| 207 | return 0 | ||
| 208 | |||
| 209 | def handle_gc_mark(args, client): | ||
| 210 | where = {k: v for k, v in args.where} | ||
| 211 | result = client.gc_mark(args.mark, where) | ||
| 212 | print("New hashes marked: %d" % result["count"]) | ||
| 213 | return 0 | ||
| 214 | |||
| 215 | def handle_gc_sweep(args, client): | ||
| 216 | result = client.gc_sweep(args.mark) | ||
| 217 | print("Removed %d rows" % result["count"]) | ||
| 218 | return 0 | ||
| 219 | |||
| 198 | parser = argparse.ArgumentParser(description='Hash Equivalence Client') | 220 | parser = argparse.ArgumentParser(description='Hash Equivalence Client') |
| 199 | parser.add_argument('--address', default=DEFAULT_ADDRESS, help='Server address (default "%(default)s")') | 221 | parser.add_argument('--address', default=DEFAULT_ADDRESS, help='Server address (default "%(default)s")') |
| 200 | parser.add_argument('--log', default='WARNING', help='Set logging level') | 222 | parser.add_argument('--log', default='WARNING', help='Set logging level') |
| @@ -274,6 +296,19 @@ def main(): | |||
| 274 | db_query_columns_parser = subparsers.add_parser('get-db-query-columns', help="Show columns that can be used in database queries") | 296 | db_query_columns_parser = subparsers.add_parser('get-db-query-columns', help="Show columns that can be used in database queries") |
| 275 | db_query_columns_parser.set_defaults(func=handle_get_db_query_columns) | 297 | db_query_columns_parser.set_defaults(func=handle_get_db_query_columns) |
| 276 | 298 | ||
| 299 | gc_status_parser = subparsers.add_parser("gc-status", help="Show garbage collection status") | ||
| 300 | gc_status_parser.set_defaults(func=handle_gc_status) | ||
| 301 | |||
| 302 | gc_mark_parser = subparsers.add_parser('gc-mark', help="Mark hashes to be kept for garbage collection") | ||
| 303 | gc_mark_parser.add_argument("mark", help="Mark for this garbage collection operation") | ||
| 304 | gc_mark_parser.add_argument("--where", "-w", metavar="KEY VALUE", nargs=2, action="append", default=[], | ||
| 305 | help="Keep entries in table where KEY == VALUE") | ||
| 306 | gc_mark_parser.set_defaults(func=handle_gc_mark) | ||
| 307 | |||
| 308 | gc_sweep_parser = subparsers.add_parser('gc-sweep', help="Perform garbage collection and delete any entries that are not marked") | ||
| 309 | gc_sweep_parser.add_argument("mark", help="Mark for this garbage collection operation") | ||
| 310 | gc_sweep_parser.set_defaults(func=handle_gc_sweep) | ||
| 311 | |||
| 277 | args = parser.parse_args() | 312 | args = parser.parse_args() |
| 278 | 313 | ||
| 279 | logger = logging.getLogger('hashserv') | 314 | logger = logging.getLogger('hashserv') |
