Apache Ignite C++ Client
Loading...
Searching...
No Matches
cancel_handle.h
Go to the documentation of this file.
1/*
2* Licensed to the Apache Software Foundation (ASF) under one or more
3* contributor license agreements. See the NOTICE file distributed with
4* this work for additional information regarding copyright ownership.
5* The ASF licenses this file to You under the Apache License, Version 2.0
6* (the "License"); you may not use this file except in compliance with
7* the License. You may obtain a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*/
17
22
23#pragma once
24
26#include "ignite/common/ignite_result.h"
27#include "ignite/common/detail/config.h"
28
29#include <memory>
30
31namespace ignite
32{
33
38{
39public:
43 virtual ~cancel_handle() = default;
44
49 [[nodiscard]] IGNITE_API static std::shared_ptr<cancel_handle> create();
50
57 IGNITE_API virtual void cancel_async(ignite_callback<void> callback) = 0;
58
65 IGNITE_API virtual void cancel() {
66 return sync<void>([this](auto callback) mutable {
67 cancel_async(std::move(callback));
68 });
69 }
70
78 IGNITE_API virtual bool is_cancelled() const = 0;
79
87 IGNITE_API virtual std::shared_ptr<cancellation_token> get_token() = 0;
88};
89
90} // namespace ignite
Definition cancel_handle.h:38
virtual IGNITE_API void cancel()
Definition cancel_handle.h:65
virtual IGNITE_API void cancel_async(ignite_callback< void > callback)=0
virtual IGNITE_API bool is_cancelled() const =0
virtual ~cancel_handle()=default
virtual IGNITE_API std::shared_ptr< cancellation_token > get_token()=0
static IGNITE_API std::shared_ptr< cancel_handle > create()
Definition cancel_handle.cpp:77