blob: a11098ad1310f4536ce15f4b410d9c25d36572ae (
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
52
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/document/bucket/bucketid.h>
#include "ibucketmodifiedhandler.h"
#include "ibucketstatecalculator.h"
#include "iclusterstatechangednotifier.h"
#include <vespa/persistence/spi/clusterstate.h>
#include <vespa/searchcore/proton/persistenceengine/resulthandler.h>
#include <vespa/vespalib/util/threadstackexecutorbase.h>
#include <set>
namespace proton {
/**
* Class handling operations in IPersistenceHandler that are dealing with
* that the cluster state is changing.
*/
class ClusterStateHandler : public IBucketModifiedHandler,
public IClusterStateChangedNotifier
{
private:
vespalib::Executor &_executor;
std::vector<IClusterStateChangedHandler *> _changedHandlers;
// storage::spi::BucketIdListResult::List _modifiedBuckets;
std::set<document::BucketId> _modifiedBuckets;
void performSetClusterState(const storage::spi::ClusterState *calc, IGenericResultHandler *resultHandler);
void performGetModifiedBuckets(IBucketIdListResultHandler *resultHandler);
// Implements IBucketModifiedHandler
void notifyBucketModified(const document::BucketId &bucket) override;
public:
ClusterStateHandler(vespalib::Executor &executor);
~ClusterStateHandler() override;
void addClusterStateChangedHandler(IClusterStateChangedHandler *handler) override;
void removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) override;
/**
* Implements the cluster state aspect of IPersistenceHandler.
*/
void handleSetClusterState(const storage::spi::ClusterState &calc, IGenericResultHandler &resultHandler);
void handleGetModifiedBuckets(IBucketIdListResultHandler &resultHandler);
};
} // namespace proton
|