blob: a4ec6bf369017e42d2cccfed49567a0f131acbe5 (
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 <vespa/vespalib/util/idestructorcallback.h>
namespace proton::feedtoken { class IState; }
namespace proton {
/**
* Context class for document operations that acks operation when
* instance is destroyed. Typically a shared pointer to an instance is
* passed around to multiple worker threads that performs portions of
* a larger task before dropping the shared pointer, triggering the
* ack when all worker threads have completed.
*/
class OperationDoneContext : public vespalib::IDestructorCallback
{
public:
OperationDoneContext(std::shared_ptr<feedtoken::IState> token, std::shared_ptr<IDestructorCallback> done_callback);
~OperationDoneContext() override;
bool is_replay() const;
private:
std::shared_ptr<feedtoken::IState> _token;
std::shared_ptr<vespalib::IDestructorCallback> _done_callback;
};
} // namespace proton
|