aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.h
blob: d9013764558413139dd5554779dbb7e5271e98db (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
38
39
40
41
42
43
44
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/util/address_space.h>
#include <vespa/vespalib/stllike/string.h>

namespace proton {

/**
 * Class representing max address space usage (relative to the limit)
 * among components in attributes vectors in all sub databases.
 */
class AddressSpaceUsageStats
{
    vespalib::AddressSpace _usage;
    vespalib::string _attributeName;
    vespalib::string _component_name;
    vespalib::string _subDbName;

public:
    explicit AddressSpaceUsageStats(const vespalib::AddressSpace &usage);
    ~AddressSpaceUsageStats();
    void merge(const vespalib::AddressSpace &usage,
               const vespalib::string &attributeName,
               const vespalib::string &component_name,
               const vespalib::string &subDbName);

    const vespalib::AddressSpace &getUsage() const { return _usage; }
    const vespalib::string &getAttributeName() const { return _attributeName; }
    const vespalib::string &get_component_name() const { return _component_name; }
    const vespalib::string &getSubDbName() const { return _subDbName; }

    bool operator==(const AddressSpaceUsageStats& rhs) const {
        return (_usage == rhs._usage) &&
                (_attributeName == rhs._attributeName) &&
                (_component_name == rhs._component_name) &&
                (_subDbName == rhs._subDbName);
    }
};

std::ostream& operator<<(std::ostream &out, const AddressSpaceUsageStats& rhs);

} // namespace proton