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

#pragma once

#include <memory>

namespace storage::spi {

class Result;

class ResultHandler {
public:
    virtual ~ResultHandler() = default;
    virtual void handle(const Result &) const = 0;
};

/**
 * This is the callback interface when using the async operations
 * in the persistence provider.
 */
class OperationComplete
{
public:
    using UP = std::unique_ptr<OperationComplete>;
    virtual ~OperationComplete() = default;
    virtual void onComplete(std::unique_ptr<Result> result) noexcept = 0;
    virtual void addResultHandler(const ResultHandler * resultHandler) = 0;
};

}