aboutsummaryrefslogtreecommitdiffstats
path: root/persistence/src/vespa/persistence/spi/catchresult.cpp
blob: 366e439cc2dac15be2bc36d3dea91904bf02d1d3 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "catchresult.h"
#include "result.h"
#include <cassert>

namespace storage::spi {

CatchResult::CatchResult()
    : _promisedResult(),
      _resulthandler(nullptr)
{}
CatchResult::~CatchResult() = default;

void
CatchResult::onComplete(std::unique_ptr<Result> result) noexcept {
    _promisedResult.set_value(std::move(result));
}
void
CatchResult::addResultHandler(const ResultHandler * resultHandler) {
    assert(_resulthandler == nullptr);
    _resulthandler = resultHandler;
}

}