blob: 6f779f1e898f51b8f1826c6add5b43814bea2302 (
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
31
32
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/stllike/string.h>
#include <functional>
#include <memory>
namespace search { class AttributeVector; }
namespace proton {
struct IAttributeManager;
/*
* Class for executing task in attribute vector write thread.
*/
class AttributeExecutor
{
private:
std::shared_ptr<IAttributeManager> _mgr;
std::shared_ptr<search::AttributeVector> _attr;
public:
AttributeExecutor(std::shared_ptr<IAttributeManager> mgr,
std::shared_ptr<search::AttributeVector> attr);
~AttributeExecutor();
void run_sync(std::function<void()> task) const;
const search::AttributeVector& get_attr() const noexcept { return *_attr; }
};
} // namespace proton
|