blob: 52709fb1d9b570d9509fc4617e88c36476b3101d (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* @class storage::StorageNodeContext
* @ingroup storageserver
*
* @brief Data available to both provider implementations and storage server
*
* This utility class sets up the default component register implementation.
* It also sets up the clock and the threadpool, such that the most basic
* features are available to the provider, before the service layer is set up.
*/
#pragma once
#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h>
#include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h>
namespace storage {
struct StorageNodeContext {
// Typedefs to simplify the remainder of the interface
using ComponentRegister = StorageComponentRegisterImpl;
/**
* Get the actual component register. Available as the actual type as the
* storage server need to set implementations, and the components need the
* actual component register interface.
*/
ComponentRegister& getComponentRegister() { return *_componentRegister; }
~StorageNodeContext();
protected:
// Initialization has been split in two as subclass needs to initialize
// component register before sending it on.
StorageNodeContext(std::unique_ptr<ComponentRegister>, std::unique_ptr<framework::Clock>);
private:
std::unique_ptr<ComponentRegister> _componentRegister;
std::unique_ptr<framework::Clock> _clock;
framework::defaultimplementation::ThreadPoolImpl _threadPool;
};
} // storage
|