aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/storageserver/distributornodecontext.h
blob: 5691d014d1fe36eebeb343ab8ce27a02489fceae (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * @class storage::DistributorNodeContext
 * @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/distributorcomponentregisterimpl.h>
#include <vespa/storage/storageserver/storagenodecontext.h>

namespace storage {

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

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

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