aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/common/storage_chain_builder.cpp
blob: 72961b5e85526afceda61c436950e881f27c4be2 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "storage_chain_builder.h"
#include "storagelink.h"

namespace storage {

StorageChainBuilder::StorageChainBuilder()
    : _top()
{
}

StorageChainBuilder::~StorageChainBuilder() = default;

void
StorageChainBuilder::add(std::unique_ptr<StorageLink> link)
{
    if (_top) {
        _top->push_back(std::move(link));
    } else {
        _top = std::move(link);
    }
};

std::unique_ptr<StorageLink>
StorageChainBuilder::build() &&
{
    return std::move(_top);
}

}