aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
blob: b4b919c6975cc4ee946c44a88aff4c79fb1cc26f (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
49
50
51
52
53
54
55
56
57
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/value.h>
#include <vespa/searchlib/queryeval/irequestcontext.h>
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <vespa/searchlib/attribute/attribute_blueprint_params.h>
#include <vespa/vespalib/util/doom.h>

namespace search::fef {
class IObjectStore;
class IQueryEnvironment;
}

namespace proton {

class RequestContext : public search::queryeval::IRequestContext,
                       public search::attribute::IAttributeExecutor
{
public:
    using IAttributeContext = search::attribute::IAttributeContext;
    using IAttributeFunctor = search::attribute::IAttributeFunctor;
    using Doom = vespalib::Doom;
    RequestContext(const Doom& softDoom,
                   IAttributeContext& attributeContext,
                   const search::fef::IQueryEnvironment& query_env,
                   search::fef::IObjectStore& shared_store,
                   const search::attribute::AttributeBlueprintParams& attribute_blueprint_params,
                   const MetaStoreReadGuardSP * metaStoreReadGuard);

    const Doom & getDoom() const override { return _doom; }
    const search::attribute::IAttributeVector *getAttribute(const vespalib::string &name) const override;

    void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override;

    const search::attribute::IAttributeVector *getAttributeStableEnum(const vespalib::string &name) const override;

    const vespalib::eval::Value* get_query_tensor(const vespalib::string& tensor_name) const override;

    const search::attribute::AttributeBlueprintParams& get_attribute_blueprint_params() const override {
        return _attribute_blueprint_params;
    }
    const MetaStoreReadGuardSP * getMetaStoreReadGuard() const override {
        return _metaStoreReadGuard;
    }

private:
    const Doom                                    _doom;
    IAttributeContext                           & _attributeContext;
    const search::fef::IQueryEnvironment        & _query_env;
    search::fef::IObjectStore                   & _shared_store;
    search::attribute::AttributeBlueprintParams   _attribute_blueprint_params;
    const MetaStoreReadGuardSP                  * _metaStoreReadGuard;
};

}