<commit_before>#pragma once

#include <map>
#include <mutex>
#include <string>
#include <unordered_map>

#include "blackhole/bigbang.hpp"
#include "blackhole/formatter/string.hpp"
#include "blackhole/frontend.hpp"
#include "blackhole/logger.hpp"
#include "blackhole/repository/config/defaults.hpp"
#include "blackhole/repository/config/log.hpp"
#include "blackhole/repository/factory/external.hpp"
#include "blackhole/sink/stream.hpp"

namespace blackhole {

//!@todo: Maybe create synchronized wrapper?

class repository_t {
    mutable std::mutex mutex;
    external_factory_t factory;
    std::unordered_map<std::string, log_config_t> configs;

public:
    static repository_t& instance() {
        static repository_t self;
        return self;
    }

    template<typename Sink, typename Formatter>
    bool available() const {
        std::lock_guard<std::mutex> lock(mutex);
        return factory.has<Sink, Formatter>();
    }<commit_msg>[Tasks] No.<commit_after>#pragma once

#include <map>
#include <mutex>
#include <string>
#include <unordered_map>

#include "blackhole/bigbang.hpp"
#include "blackhole/formatter/string.hpp"
#include "blackhole/frontend.hpp"
#include "blackhole/logger.hpp"
#include "blackhole/repository/config/defaults.hpp"
#include "blackhole/repository/config/log.hpp"
#include "blackhole/repository/factory/external.hpp"
#include "blackhole/sink/stream.hpp"

namespace blackhole {

class repository_t {
    mutable std::mutex mutex;
    external_factory_t factory;
    std::unordered_map<std::string, log_config_t> configs;

public:
    static repository_t& instance() {
        static repository_t self;
        return self;
    }

    template<typename Sink, typename Formatter>
    bool available() const {
        std::lock_guard<std::mutex> lock(mutex);
        return factory.has<Sink, Formatter>();
    }
{'fraction_non_alphanumeric': 0.12310195227765727, 'fraction_numerical': 0.0, 'mean_word_length': 4.60790273556231, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5873183', 'n_tokens_mistral': 587, 'n_tokens_neox': 579, 'n_words': 124}