aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/persistence/apply_bucket_diff_entry_complete.h
blob: a78fbe38ae534892d646fd5541005fbab00bbb41 (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.

#pragma once

#include "shared_operation_throttler.h"
#include <vespa/document/base/documentid.h>
#include <vespa/metrics/valuemetric.h>
#include <vespa/persistence/spi/operationcomplete.h>
#include <vespa/storageframework/generic/clock/timer.h>
#include <future>

namespace storage {

class ApplyBucketDiffState;

/*
 * Complete handler for a bucket diff entry spi operation (putAsync
 * or removeAsync)
 */
class ApplyBucketDiffEntryComplete : public spi::OperationComplete
{
    const spi::ResultHandler*             _result_handler;
    std::shared_ptr<ApplyBucketDiffState> _state;
    document::DocumentId                  _doc_id;
    ThrottleToken                         _throttle_token;
    const char*                           _op;
    framework::MilliSecTimer              _start_time;
    metrics::DoubleAverageMetric&         _latency_metric;
public:
    ApplyBucketDiffEntryComplete(std::shared_ptr<ApplyBucketDiffState> state,
                                 document::DocumentId doc_id,
                                 ThrottleToken throttle_token,
                                 const char *op, const framework::Clock& clock,
                                 metrics::DoubleAverageMetric& latency_metric);
    ~ApplyBucketDiffEntryComplete() override;
    void onComplete(std::unique_ptr<spi::Result> result) noexcept override;
    void addResultHandler(const spi::ResultHandler* resultHandler) override;
};

}