aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h
blob: 013f9e9f0047e3df8baf398775d483c7e7cad8ed (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "i_reprocessing_task.h"
#include <vespa/searchcore/proton/docsummary/isummarymanager.h>
#include <vespa/searchcore/proton/attribute/i_attribute_manager.h>
#include "attribute_reprocessing_initializer.h"
#include "document_reprocessing_handler.h"
#include "i_reprocessing_initializer.h"

namespace proton
{

/**
 * The reprocessing documents task handles reprocessing of documents,
 * e.g. populate attributes from document store when adding attribute
 * aspect on existing field and populating documents in document store
 * when removing attribute aspect on existing field.
 */
class ReprocessDocumentsTask : public IReprocessingTask,
                               public search::IDocumentStoreVisitorProgress
{
    proton::ISummaryManager::SP          _sm;
    document::DocumentTypeRepo::SP       _docTypeRepo;
    vespalib::string                     _subDbName;
    double                               _visitorProgress;
    double                               _visitorCost;
    DocumentReprocessingHandler          _handler;
    int64_t                              _startTime;
    double                               _loggedProgress;
    int64_t                              _loggedTime;

public:
    ReprocessDocumentsTask(IReprocessingInitializer &initializer,
                           const proton::ISummaryManager::SP &sm,
                           const document::DocumentTypeRepo::SP &docTypeRepo,
                           const vespalib::string &subDbName,
                           uint32_t docIdLimit);

    virtual void
    run();

    virtual void
    updateProgress(double progress);

    virtual Progress
    getProgress() const; 
};

} // namespace proton