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

#include "state_reporter_utils.h"
#include <vespa/vespalib/data/slime/cursor.h>

using namespace vespalib::slime;

namespace proton {

void
StateReporterUtils::convertToSlime(const StatusReport &statusReport,
                                   const Inserter &inserter)
{
    Cursor &object = inserter.insertObject();
    object.setString("state", statusReport.getInternalState());
    if (statusReport.hasProgress()) {
        object.setDouble("progress", statusReport.getProgress());
    }
    if (!statusReport.getInternalConfigState().empty()) {
        object.setString("configState", statusReport.getInternalConfigState());
    }
    if (!statusReport.getMessage().empty()) {
        object.setString("message", statusReport.getMessage());
    }
}

} // namespace proton