aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h
blob: 09aa28230d789a3a9947378b5249a3671fd8bb41 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/util/thread_bundle.h>

namespace search::engine {
    class SearchRequest;
    class SearchReply;
    class DocsumRequest;
    class DocsumReply;
}

namespace proton {

/**
 * This interface describes a sync summary operation handler. It is
 * implemented by the DocumentDB class, and used by the SummaryEngine
 * class to delegate operations to the appropriate db.
 */
class ISearchHandler {
protected:
    ISearchHandler() = default;
    using DocsumReply = search::engine::DocsumReply;
    using SearchReply = search::engine::SearchReply;
    using SearchRequest = search::engine::SearchRequest;
    using DocsumRequest = search::engine::DocsumRequest;
    using ThreadBundle = vespalib::ThreadBundle;
public:
    using SP = std::shared_ptr<ISearchHandler>;

    ISearchHandler(const ISearchHandler &) = delete;
    ISearchHandler & operator = (const ISearchHandler &) = delete;
    virtual ~ISearchHandler() = default;

    /**
     * @return Use the request and produce the document summary result.
     */
    virtual std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & request) = 0;

    virtual std::unique_ptr<SearchReply>
    match(const SearchRequest &req, ThreadBundle &threadBundle) const = 0;
};

} // namespace proton