aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/attributeguard.h
blob: 1e1fdb12738a8cba6b9ef364fbed9479e6bafbde (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "componentguard.h"
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <shared_mutex>

namespace search {

class AttributeVector;

/**
 * This class makes sure that you will have a consistent view per document in the attribute vector
 * while the guard is held.
 **/
class AttributeGuard : public ComponentGuard<AttributeVector>
{
public:
    using UP = std::unique_ptr<AttributeGuard>;
    using SP = std::shared_ptr<AttributeGuard>;
    using AttributeVectorSP = std::shared_ptr<AttributeVector>;
    AttributeGuard();
    AttributeGuard(const AttributeVectorSP & attribute);
};

}