aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/persistence/bucketprocessor.h
blob: 3c2383967c8499688cad918e33b80fdef446a5b0 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * Class that simplifies operations where we want to iterate through all
 * the documents in a bucket (possibly with a document selection) and do
 * something with each entry.
 */
#pragma once

#include <vespa/persistence/spi/bucket.h>
#include <vespa/persistence/spi/context.h>
#include <vespa/persistence/spi/types.h>

namespace document { class FieldSet; }
namespace storage::spi {
    struct PersistenceProvider;
    class DocEntry;
}

namespace storage {

class BucketProcessor
{
public:
    class EntryProcessor {
    public:
        virtual ~EntryProcessor() {};
        virtual void process(spi::DocEntry&) = 0;
    };

    static void iterateAll(spi::PersistenceProvider&,
                           const spi::Bucket&,
                           const std::string& documentSelection,
                           std::shared_ptr<document::FieldSet> field_set,
                           EntryProcessor&,
                           spi::IncludedVersions,
                           spi::Context&);
};

}