summaryrefslogtreecommitdiffstats
path: root/persistence/src/vespa/persistence/spi/catchresult.h
diff options
context:
space:
mode:
Diffstat (limited to 'persistence/src/vespa/persistence/spi/catchresult.h')
-rw-r--r--persistence/src/vespa/persistence/spi/catchresult.h22
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;
+};
+
+}