aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/storageserver/servicelayernodecontext.h
blob: 72cf95ef120e53c7f86db92c51cb8d44ff4cd838 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * @class storage::ServiceLayerNodeContext
 * @ingroup storageserver
 *
 * @brief Context needed by node, that can also be used by others
 *
 * 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/servicelayercomponentregisterimpl.h>
#include <vespa/storage/storageserver/storagenodecontext.h>

namespace storage {

struct ServiceLayerNodeContext : public StorageNodeContext {
    // Typedefs to simplify the remainder of the interface
    using ComponentRegister = ServiceLayerComponentRegisterImpl;

    /**
     * You can provide your own clock implementation. Useful in testing where
     * you want to fake the clock.
     */
    ServiceLayerNodeContext(std::unique_ptr<framework::Clock> clock, const ContentBucketDbOptions& db_opts);

    /**
     * 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; }

private:
    ComponentRegister& _componentRegister;
};

} // storage