<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def metadata_verify(config, args) -> int: """ Crawl all saved JSON metadata or online to check we have all packages if delete - generate a diff of unowned files """

    all_package_files = []  # type: List[Path]
    loop = asyncio.get_event_loop()
    mirror_base = config.get("mirror", "directory")
    json_base = Path(mirror_base) / "web" / "json"
    workers = args.workers or config.getint("mirror", "workers")
    executor = concurrent.futures.ThreadPoolExecutor(max_workers=workers)

    logger.info(f"Starting verify for {mirror_base} with {workers} workers")
    try:
        json_files = await loop.run_in_executor(executor, os.listdir, json_base)
    except FileExistsError as fee:
        logger.error(f"Metadata base dir {json_base} does not exist: {fee}")
        return 2
    if not json_files:
        logger.error("No JSON metadata files found. Can not verify")
        return 3

    logger.debug(f"Found {len(json_files)} objects in {json_base}")
    logger.debug(f"Using a {workers} thread ThreadPoolExecutor")
    await async_verify(
        config, all_package_files, mirror_base, json_files, args, executor
    )

    if not args.delete:
        return 0

    return await delete_files(mirror_base, executor, all_package_files, args.dry_run)