aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h
blob: 98219c0c2451848c15d3d48255540d58b41525cb (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "i_document_retriever.h"
#include <vespa/searchcore/proton/common/ipendinglidtracker.h>

namespace proton {

/*
 * Wrapper class for document retriever that performs commit and waits for
 * it to complete before retrieving document. This is used to ensure that
 * attribute vectors are committed before we read from them.
 */
class CommitAndWaitDocumentRetriever : public IDocumentRetriever
{
    IDocumentRetriever::SP _retriever;
    ILidCommitState       &_uncommittedLidsTracker;
    using Bucket = storage::spi::Bucket;
public:
    CommitAndWaitDocumentRetriever(IDocumentRetriever::SP retriever, ILidCommitState & unCommittedLidTracker);
    ~CommitAndWaitDocumentRetriever() override;

    const document::DocumentTypeRepo &getDocumentTypeRepo() const override;
    void getBucketMetaData(const Bucket &bucket, search::DocumentMetaData::Vector &result) const override;
    search::DocumentMetaData getDocumentMetaData(const document::DocumentId &id) const override;
    DocumentUP getFullDocument(search::DocumentIdT lid) const override;
    DocumentUP getPartialDocument(search::DocumentIdT lid, const document::DocumentId & docId, const document::FieldSet & fieldSet) const override;
    void visitDocuments(const LidVector &lids, search::IDocumentVisitor &visitor, ReadConsistency readConsistency) const override;
    CachedSelect::SP parseSelect(const vespalib::string &selection) const override;
    ReadGuard getReadGuard() const override;
    uint32_t getDocIdLimit() const override;
};

} // namespace proton