aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h
blob: 1ac4af0997ac9bda25dbbba304aa123fd19cccde (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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

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

namespace storage::api { class RemoveLocationCommand; }

namespace storage::distributor {

class DistributorBucketSpace;

class RemoveLocationOperation : public Operation {
public:
    RemoveLocationOperation(const DistributorNodeContext& node_ctx,
                            DistributorStripeOperationContext& op_ctx,
                            const DocumentSelectionParser& parser,
                            DistributorBucketSpace& bucketSpace,
                            std::shared_ptr<api::RemoveLocationCommand> msg,
                            PersistenceOperationMetricSet& metric);
    ~RemoveLocationOperation() override;


    static int getBucketId(const DistributorNodeContext& node_ctx,
                           const DocumentSelectionParser& parser,
                           const api::RemoveLocationCommand& cmd,
                           document::BucketId& id);
    void onStart(DistributorStripeMessageSender& sender) override;
    const char* getName() const noexcept override { return "removelocation"; };
    std::string getStatus() const override { return ""; };
    void onReceive(DistributorStripeMessageSender& sender, const std::shared_ptr<api::StorageReply>&) override;
    void onClose(DistributorStripeMessageSender& sender) override;
private:
    PersistenceMessageTracker                   _tracker;
    std::shared_ptr<api::RemoveLocationCommand> _msg;
    const DistributorNodeContext&               _node_ctx;
    const DocumentSelectionParser&              _parser;
    DistributorBucketSpace&                     _bucketSpace;
};

}