aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.h
blob: ceab13481b576bff8901304ef2603374a2d37db9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "i_maintenance_job.h"

namespace proton {

struct IAttributeManager;
class AttributeUsageFilter;

/**
 * Class used to sample attribute resource usage and pass aggregated
 * information to attribute usage filter to block feeding before
 * proton crashes due to attribute structure size limitations.
 */
class SampleAttributeUsageJob : public IMaintenanceJob
{
    using IAttributeManagerSP = std::shared_ptr<IAttributeManager>;

    IAttributeManagerSP   _readyAttributeManager;
    IAttributeManagerSP   _notReadyAttributeManager;
    AttributeUsageFilter &_attributeUsageFilter;

public:
    SampleAttributeUsageJob(IAttributeManagerSP readyAttributeManager,
                            IAttributeManagerSP notReadyAttributeManager,
                            AttributeUsageFilter &attributeUsageFilter,
                            const vespalib::string &docTypeName,
                            vespalib::duration interval);
    ~SampleAttributeUsageJob() override;

    bool run() override;
    void onStop() override { }
};

} // namespace proton