aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h
blob: 0909def0e5cde6d38c3a89ce13e9c74bd80b4196 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * \class storage::framework::StorageComponentRegisterImpl
 * \ingroup component
 *
 * \brief Subclass of component register impl that handles storage components.
 */
#pragma once

#include "storagecomponentregisterimpl.h"
#include <vespa/storage/bucketdb/minimumusedbitstracker.h>
#include <vespa/storage/common/content_bucket_space_repo.h>
#include <vespa/storage/common/servicelayercomponent.h>

namespace storage {

class ServiceLayerComponentRegisterImpl
        : public virtual ServiceLayerComponentRegister,
          public virtual StorageComponentRegisterImpl
{
    std::mutex _componentLock;
    std::vector<ServiceLayerManagedComponent*> _components;
    ContentBucketSpaceRepo _bucketSpaceRepo;
    MinimumUsedBitsTracker _minUsedBitsTracker;

public:
    using UP = std::unique_ptr<ServiceLayerComponentRegisterImpl>;

    explicit ServiceLayerComponentRegisterImpl(const ContentBucketDbOptions&);

    ContentBucketSpaceRepo& getBucketSpaceRepo() { return _bucketSpaceRepo; }
    MinimumUsedBitsTracker& getMinUsedBitsTracker() {
        return _minUsedBitsTracker;
    }

    void registerServiceLayerComponent(ServiceLayerManagedComponent&) override;
    void setDistribution(std::shared_ptr<lib::Distribution> distribution) override;
};

} // storage