aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.cpp
blob: 31c546659d40c42f55076289012c32cf65556215 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "attribute_usage_sampler_context.h"
#include "attribute_usage_filter.h"

namespace proton {

AttributeUsageSamplerContext::AttributeUsageSamplerContext(AttributeUsageFilter& filter)
    : _usage(),
      _lock(),
      _filter(filter)
{
}

AttributeUsageSamplerContext::~AttributeUsageSamplerContext()
{
    _filter.setAttributeStats(_usage);
}

void
AttributeUsageSamplerContext::merge(const search::AddressSpaceUsage &usage,
                                    const vespalib::string &attributeName,
                                    const vespalib::string &subDbName)
{
    Guard guard(_lock);
    _usage.merge(usage, attributeName, subDbName);
}

}