<commit_before>// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "executor_observer.h"
#include "thread_service_observer.h"
#include <vespa/searchcorespi/index/ithreadingservice.h>
#include <vespa/searchlib/common/sequencedtaskexecutorobserver.h>

namespace proton {
namespace test {

class ThreadingServiceObserver : public searchcorespi::index::IThreadingService
{
private:
    searchcorespi::index::IThreadingService &_service;
    ThreadServiceObserver _master;
    ThreadServiceObserver _index;
    search::SequencedTaskExecutorObserver _indexFieldInverter;
    search::SequencedTaskExecutorObserver _indexFieldWriter;
    search::SequencedTaskExecutorObserver _attributeFieldWriter;

public:
    ThreadingServiceObserver(searchcorespi::index::IThreadingService &service)
        : _service(service),
          _master(_service.master()),
          _index(service.index()),
          _indexFieldInverter(_service.indexFieldInverter()),
          _indexFieldWriter(_service.indexFieldWriter()),
          _attributeFieldWriter(_service.attributeFieldWriter())
    {
    }
    const ThreadServiceObserver &masterObserver() const {
        return _master;
    }
    const ThreadServiceObserver &indexObserver() const {
        return _index;
    }
    const search::SequencedTaskExecutorObserver &indexFieldInverterObserver()
        const
    {
        return _indexFieldInverter;
    }
    const search::SequencedTaskExecutorObserver &indexFieldWriterObserver()
        const
    {
        return _indexFieldWriter;
    }

    const search::SequencedTaskExecutorObserver &attributeFieldWriterObserver()
        const
    {<commit_msg>Add explicit threading service observer destructor.<commit_after>// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "executor_observer.h"
#include "thread_service_observer.h"
#include <vespa/searchcorespi/index/ithreadingservice.h>
#include <vespa/searchlib/common/sequencedtaskexecutorobserver.h>

namespace proton {
namespace test {

class ThreadingServiceObserver : public searchcorespi::index::IThreadingService
{
private:
    searchcorespi::index::IThreadingService &_service;
    ThreadServiceObserver _master;
    ThreadServiceObserver _index;
    search::SequencedTaskExecutorObserver _indexFieldInverter;
    search::SequencedTaskExecutorObserver _indexFieldWriter;
    search::SequencedTaskExecutorObserver _attributeFieldWriter;

public:
    ThreadingServiceObserver(searchcorespi::index::IThreadingService &service)
        : _service(service),
          _master(_service.master()),
          _index(service.index()),
          _indexFieldInverter(_service.indexFieldInverter()),
          _indexFieldWriter(_service.indexFieldWriter()),
          _attributeFieldWriter(_service.attributeFieldWriter())
    {
    }
    virtual ~ThreadingServiceObserver() override { }
    const ThreadServiceObserver &masterObserver() const {
        return _master;
    }
    const ThreadServiceObserver &indexObserver() const {
        return _index;
    }
    const search::SequencedTaskExecutorObserver &indexFieldInverterObserver()
        const
    {
        return _indexFieldInverter;
    }
    const search::SequencedTaskExecutorObserver &indexFieldWriterObserver()
        const
    {
        return _indexFieldWriter;
    }

    const search::SequencedTaskExecutorObserver &attributeFieldWriterObserver()
        const
    {
{'fraction_non_alphanumeric': 0.07794408359220559, 'fraction_numerical': 0.003388873199661113, 'mean_word_length': 4.286567164179105, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4671824', 'n_tokens_mistral': 939, 'n_tokens_neox': 903, 'n_words': 184}