aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_factory.cpp
blob: 35321d2baab2599a8a343699cd5ce21066ff55c1 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "tls_stats_factory.h"
#include "tls_stats_map.h"
#include <vespa/searchlib/transactionlog/translogserver.h>

using search::transactionlog::DomainInfo;
using search::transactionlog::DomainStats;

namespace proton::flushengine {

TlsStatsFactory::TlsStatsFactory(TransLogServer::SP tls)
    : _tls(tls)
{
}

TlsStatsFactory::~TlsStatsFactory()
{
}

TlsStatsMap
TlsStatsFactory::create()
{
    DomainStats stats  = _tls->getDomainStats();
    TlsStatsMap::Map map;
    for (auto &itr : stats) {
        const DomainInfo &di = itr.second;
        map.insert(std::make_pair(itr.first,
                                  TlsStats(di.byteSize,
                                           di.range.from(),
                                           di.range.to())));
    }
    return TlsStatsMap(std::move(map));
}

}