aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/i_document_scan_iterator.h
blob: 398dfe8c3bf296daecb27ac779692027e8f5de9a (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchlib/common/idocumentmetastore.h>

namespace proton {

/**
 * Iterator for scanning all documents in a document sub db to find candidates
 * for moving as part of lid space compaction.
 */
struct IDocumentScanIterator
{
    using UP = std::unique_ptr<IDocumentScanIterator>;

    virtual ~IDocumentScanIterator() = default;

    /**
     * Returns false if we are certain there are no more documents to scan, true otherwise.
     * Returning false should only happen after a call to next() has returned an invalid document.
     */
    virtual bool valid() const = 0;

    /**
     * Returns the next document that has lid > compactLidLimit to be moved.
     * Returns an invalid document if no documents satisfy the limit.
     *
     * @param compactLidLimit The returned document must have lid larger than this limit.
     */
    virtual search::DocumentMetaData next(uint32_t compactLidLimit) = 0;
};

} // namespace proton