diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-10-16 00:19:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-16 00:19:52 +0200 |
commit | 4d60d2845dba1fcfb2b68bd64a616d50578bf88c (patch) | |
tree | e1bc96e148b3a9d7a12963c3f3d1cf9dabefac94 /persistence/src/vespa/persistence/spi/catchresult.h | |
parent | bdf432f73eadcdc4b21570ad52d5da3bd3a68fc1 (diff) | |
parent | 7abe325aaf70ea093d81cebbd5828a502691cd18 (diff) |
Merge pull request #19597 from vespa-engine/balder/factor-out-catchresultv7.484.47
Factor out CatchResult
Diffstat (limited to 'persistence/src/vespa/persistence/spi/catchresult.h')
-rw-r--r-- | persistence/src/vespa/persistence/spi/catchresult.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/persistence/src/vespa/persistence/spi/catchresult.h b/persistence/src/vespa/persistence/spi/catchresult.h new file mode 100644 index 00000000000..80d4f863971 --- /dev/null +++ b/persistence/src/vespa/persistence/spi/catchresult.h @@ -0,0 +1,22 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "operationcomplete.h" +#include <future> + +namespace storage::spi { + +class CatchResult : public OperationComplete { +public: + CatchResult(); + ~CatchResult() override; + std::future<std::unique_ptr<Result>> future_result() { + return _promisedResult.get_future(); + } + void onComplete(std::unique_ptr<Result> result) override; + void addResultHandler(const ResultHandler * resultHandler) override; +private: + std::promise<std::unique_ptr<Result>> _promisedResult; + const ResultHandler *_resulthandler; +}; + +} |