aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.cpp
blob: d0f0d50ca69bb92c8469f82e312206ba7a9b1c96 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "raw_buffer_store.h"
#include <vespa/vespalib/datastore/array_store.hpp>
#include <cassert>

using vespalib::alloc::MemoryAllocator;
using vespalib::datastore::ArrayStoreConfig;
using vespalib::datastore::EntryRef;

namespace {

constexpr float ALLOC_GROW_FACTOR = 0.2;

}

namespace search::attribute {

RawBufferStore::RawBufferStore(std::shared_ptr<vespalib::alloc::MemoryAllocator> allocator, uint32_t max_type_id, double grow_factor)
    : _array_store(ArrayStoreType::optimizedConfigForHugePage(max_type_id,
                                                              TypeMapper(max_type_id, grow_factor, max_buffer_size),
                                                              MemoryAllocator::HUGEPAGE_SIZE,
                                                              MemoryAllocator::PAGE_SIZE,
                                                              max_buffer_size,
                                                              8_Ki, ALLOC_GROW_FACTOR),
                   std::move(allocator), TypeMapper(max_type_id, grow_factor, max_buffer_size))
{
}

RawBufferStore::~RawBufferStore() = default;

}

namespace vespalib::datastore {

template class ArrayStore<char, EntryRefT<19>, ArrayStoreDynamicTypeMapper<char>>;

}