aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/save_utils.cpp
blob: 639386c2f75a74b506fea568b47f307f9bc5921d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "save_utils.h"
#include <cassert>

namespace search::attribute {

EntryRefVector
make_entry_ref_vector_snapshot(const vespalib::RcuVectorBase<vespalib::datastore::AtomicEntryRef>& ref_vector, uint32_t size)
{
    assert(size <= ref_vector.get_size());
    auto* source = &ref_vector.get_elem_ref(0);
    EntryRefVector result;
    result.reserve(size);
    for (uint32_t lid = 0; lid < size; ++lid) {
        result.emplace_back(source[lid].load_relaxed());
    }
    return result;
}

}