aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.h
blob: cccd38d6557b5e1dc9e64368a87b3ea25d28c6c4 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * @class StatCallback
 * @ingroup distributor
 *
 * @brief Callback class handling StatBucket messages.
 */
#pragma once

#include <vespa/storage/distributor/operations/operation.h>
#include <map>

namespace storage::api { class StatBucketCommand; }

namespace storage::distributor {

class DistributorBucketSpace;

class StatBucketOperation : public Operation
{
public:
    StatBucketOperation(DistributorBucketSpace &bucketSpace,
                        const std::shared_ptr<api::StatBucketCommand> & cmd);
    ~StatBucketOperation() override;

    const char* getName() const noexcept override { return "statBucket"; }
    std::string getStatus() const override { return ""; }
    void onClose(DistributorStripeMessageSender& sender) override;
    void onStart(DistributorStripeMessageSender& sender) override;
    void onReceive(DistributorStripeMessageSender& sender, const std::shared_ptr<api::StorageReply> & msg) override;
private:
    DistributorBucketSpace&                 _bucketSpace;
    std::shared_ptr<api::StatBucketCommand> _command;
    std::map<uint64_t, uint16_t>            _sent;
    std::map<uint16_t, std::string>         _results;
};

}