aboutsummaryrefslogtreecommitdiffstats
path: root/slobrok/src/vespa/slobrok/server/reserved_name.h
blob: febfed97c6d68ee40c954d233ef1d910774ed61d (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "named_service.h"
#include <chrono>

namespace slobrok {

//-----------------------------------------------------------------------------

/**
 * @class ReservedName
 * @brief A reservation for a name
 *
 * a reservation expires 15 seconds after it is created.
 **/

class ReservedName: public NamedService
{
private:
    using steady_clock = std::chrono::steady_clock;
    steady_clock::time_point _reservedTime;
    int64_t milliseconds() const;
public:
    const bool isLocal;

    ReservedName(const std::string &name, const std::string &spec, bool local);
    bool stillReserved() const;
};

//-----------------------------------------------------------------------------

} // namespace slobrok