summaryrefslogtreecommitdiffstats
path: root/storageserver/src/vespa/storageserver/app/servicelayerprocess.h
blob: f95b952a68d96e6b8cc60e5d176bbedc91a9f059 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * \class storage::ServiceLayerProcess
 *
 * \brief A process running a service layer.
 */
/**
 * \class storage::MemFileServiceLayerProcess
 *
 * \brief A process running a service layer with memfile persistence provider.
 */
/**
 * \class storage::RpcServiceLayerProcess
 *
 * \brief A process running a service layer with RPC persistence provider.
 */
#pragma once

#include "process.h"
#include <vespa/storage/storageserver/servicelayernodecontext.h>
#include <vespa/storage/common/visitorfactory.h>

namespace config { class ConfigUri; }

namespace storage {

namespace spi { struct PersistenceProvider; }

class ServiceLayerNode;
class IStorageChainBuilder;

class ServiceLayerProcess : public Process {
protected:
    VisitorFactory::Map _externalVisitors;
private:
    std::unique_ptr<ServiceLayerNode> _node;
    std::unique_ptr<IStorageChainBuilder> _storage_chain_builder;

protected:
    ServiceLayerNodeContext _context;

public:
    explicit ServiceLayerProcess(const config::ConfigUri & configUri);
    ~ServiceLayerProcess() override;

    void shutdown() override;

    virtual void setupProvider() = 0;
    virtual spi::PersistenceProvider& getProvider() = 0;

    void createNode() override;
    StorageNode& getNode() override;
    StorageNodeContext& getContext() override;
    std::string getComponentName() const override;
    void set_storage_chain_builder(std::unique_ptr<IStorageChainBuilder> builder);
    virtual void add_external_visitors();
};

} // storage