aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/engine/request.cpp
blob: e4ab55fcacfad81c3e752f7ded93392e262e1998 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "request.h"

namespace search::engine {

Request::Request(RelativeTime relativeTime)
    : Request(std::move(relativeTime), 0)
{}

Request::Request(RelativeTime relativeTime, uint32_t reservePropMaps)
    : _relativeTime(std::move(relativeTime)),
      _timeOfDoom(vespalib::steady_time::max()),
      dumpFeatures(false),
      ranking(),
      location(),
      propertiesMap(reservePropMaps),
      stackDump(),
      _trace(_relativeTime, 0)
{
}

Request::~Request() = default;

void Request::setTimeout(vespalib::duration timeout)
{
    _timeOfDoom = getStartTime() + timeout;
}

vespalib::duration Request::getTimeUsed() const
{
    return _relativeTime.timeSinceDawn();
}

vespalib::duration Request::getTimeLeft() const
{
    return _timeOfDoom - _relativeTime.now();
}

}