aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h
blob: 76cd9dbdf064ca2dde4301fcde400d79b9e603fb (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright Yahoo. 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 <vespa/searchcommon/attribute/i_document_meta_store_context.h>

namespace search::attribute { struct AttributeBlueprintParams; }
namespace search::attribute { class IAttributeVector; }
namespace vespalib::eval { struct Value; }
namespace vespalib { class Doom; }

namespace search::queryeval {

/**
 * Provides a context that follows the life of a query.
 */
class IRequestContext
{
public:
    using MetaStoreReadGuardSP = std::shared_ptr<IDocumentMetaStoreContext::IReadGuard>;
    virtual ~IRequestContext() = default;

    /**
     * Provides the time of soft doom for the query. Now it is time to start cleaning up and return what you have.
     * @return time of soft doom.
     */
    virtual const vespalib::Doom & getDoom() const = 0;

    /**
     * Provide access to attributevectors
     * @return AttributeVector or nullptr if it does not exist.
     */
    virtual const attribute::IAttributeVector *getAttribute(const vespalib::string &name) const = 0;
    virtual const attribute::IAttributeVector *getAttributeStableEnum(const vespalib::string &name) const = 0;

    /**
     * Returns the tensor of the given name that was passed with the query.
     * Returns nullptr if the tensor is not found or if it is not a tensor.
     */
    virtual const vespalib::eval::Value* get_query_tensor(const vespalib::string& tensor_name) const = 0;

    virtual const search::attribute::AttributeBlueprintParams& get_attribute_blueprint_params() const = 0;

    virtual const MetaStoreReadGuardSP * getMetaStoreReadGuard() const = 0;
};

}