def store(config, archiver, revision, stats):
    """
    Store a revision record within an archiver folder.

    :param config: The configuration
    :type  config: :class:`wily.config.WilyConfig`

    :param archiver: The name of the archiver type (e.g. 'git')
    :type  archiver: ``str``
    
    :param revision: The revision ID
    :type  revision: ``str``
    
    :param stats: The collected data
    :type  stats: ``dict``
    
    :return: The absolute path to the created file
    :rtype: ``str``

    :rtype: `pathlib.Path`
    """
    root = pathlib.Path(config.cache_path) / archiver.name

    if not root.exists():
        logger.debug("Creating wily cache")
        root.mkdir()

    # fix absolute path references.
    if config.path != ".":
        for operator, operator_data in list(stats["operator_data"].items()):
            if operator_data:
                new_operator_data = operator_data.copy()
                for k, v in list(operator_data.items()):
                    new_key = os.path.relpath(str(k), str(config.path))
                    del new_operator_data[k]
                    new_operator_data[new_key] = v
                del stats["operator_data"][operator]
                stats["operator_data"][operator] = new_operator_data

    logger.debug(f"Creating {revision.key} output")
    filename = root / (revision.key + ".json")
    if filename.exists():
        raise RuntimeError(f"File {filename} already exists, index may be corrupt.")
    with open(filename, "w") as out:
        out.write(json.dumps(stats, indent=2))
    return filename
Store a revision record within an archiver folder.

    :param config: The configuration
    :type  config: :class:`wily.config.WilyConfig`

    :param archiver: The name of the archiver type (e.g. 'git')
    :type  archiver: ``str``
    
    :param revision: The revision ID
    :type  revision: ``str``
    
    :param stats: The collected data
    :type  stats: ``dict``
    
    :return: The absolute path to the created file
    :rtype: ``str``

    :rtype: `pathlib.Path`