aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/distributor_status.h
blob: fe336bbc7169821cc0554b63ab98dcc920bb9602 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <condition_variable>
#include <iosfwd>
#include <mutex>

namespace storage::framework {
class HttpUrlPath;
struct StatusReporter;
}

namespace storage::distributor {

struct DelegatedStatusRequest;

// TODO STRIPE description
class DistributorStatus {
    const DelegatedStatusRequest& _request;
    std::mutex              _lock;
    std::condition_variable _cond;
    bool                    _done;

public:
    DistributorStatus(const DelegatedStatusRequest& request) noexcept
        : _request(request),
          _lock(),
          _cond(),
          _done(false)
    {}

    std::ostream& getStream();
    const framework::HttpUrlPath& getPath() const;
    const framework::StatusReporter& getReporter() const;

    void notifyCompleted();
    void waitForCompletion();
};

}