blob: ae39bb0805e96a1d315b1722fe9f445f41d3baf8 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "applicationgenerationfetcher.h"
#include "servicelayernodecontext.h"
#include "storagenode.h"
#include "vespa/vespalib/util/jsonstream.h"
#include <vespa/config-persistence.h>
#include <vespa/config-stor-filestor.h>
#include <vespa/storage/common/nodestateupdater.h>
#include <vespa/storage/common/visitorfactory.h>
#include <vespa/storage/visiting/config-stor-visitor.h>
#include <vespa/storage/visiting/visitormessagesessionfactory.h>
namespace storage {
namespace spi { struct PersistenceProvider; }
class Bouncer;
class BucketManager;
class ChangedBucketOwnershipHandler;
class FileStorManager;
class MergeThrottler;
class ModifiedBucketChecker;
class VisitorManager;
class ServiceLayerNode
: public StorageNode,
private VisitorMessageSessionFactory,
private NodeStateReporter
{
public:
using PersistenceConfig = vespa::config::content::PersistenceConfig;
using StorVisitorConfig = vespa::config::content::core::StorVisitorConfig;
using StorFilestorConfig = vespa::config::content::StorFilestorConfig;
private:
ServiceLayerNodeContext& _context;
spi::PersistenceProvider& _persistenceProvider;
VisitorFactory::Map _externalVisitors;
std::unique_ptr<PersistenceConfig> _persistence_bootstrap_config;
std::unique_ptr<StorVisitorConfig> _visitor_bootstrap_config;
std::unique_ptr<StorFilestorConfig> _filestor_bootstrap_config;
Bouncer* _bouncer;
BucketManager* _bucket_manager;
ChangedBucketOwnershipHandler* _changed_bucket_ownership_handler;
FileStorManager* _fileStorManager;
MergeThrottler* _merge_throttler;
VisitorManager* _visitor_manager;
ModifiedBucketChecker* _modified_bucket_checker;
bool _init_has_been_called;
public:
using UP = std::unique_ptr<ServiceLayerNode>;
struct ServiceLayerBootstrapConfigs {
BootstrapConfigs storage_bootstrap_configs;
std::unique_ptr<PersistenceConfig> persistence_cfg;
std::unique_ptr<StorVisitorConfig> visitor_cfg;
std::unique_ptr<StorFilestorConfig> filestor_cfg;
ServiceLayerBootstrapConfigs();
~ServiceLayerBootstrapConfigs();
ServiceLayerBootstrapConfigs(ServiceLayerBootstrapConfigs&&) noexcept;
ServiceLayerBootstrapConfigs& operator=(ServiceLayerBootstrapConfigs&&) noexcept;
};
ServiceLayerNode(const config::ConfigUri & configUri,
ServiceLayerNodeContext& context,
ServiceLayerBootstrapConfigs bootstrap_configs,
ApplicationGenerationFetcher& generationFetcher,
spi::PersistenceProvider& persistenceProvider,
const VisitorFactory::Map& externalVisitors);
~ServiceLayerNode() override;
/**
* Init must be called exactly once after construction and before destruction.
*/
void init();
void on_configure(const StorServerConfig& config);
void on_configure(const PersistenceConfig& config);
void on_configure(const StorVisitorConfig& config);
void on_configure(const StorFilestorConfig& config);
const lib::NodeType& getNodeType() const override { return lib::NodeType::STORAGE; }
ResumeGuard pause() override;
private:
void report(vespalib::JsonStream &writer) const override;
void initializeNodeSpecific() override;
void perform_post_chain_creation_init_steps() override;
void handleLiveConfigUpdate(const InitialGuard & initGuard) override;
VisitorMessageSession::UP createSession(Visitor&, VisitorThread&) override;
documentapi::Priority::Value toDocumentPriority(uint8_t storagePriority) const override;
void createChain(IStorageChainBuilder &builder) override;
void on_bouncer_config_changed() override;
};
} // storage
|