diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-11 16:25:16 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-11 16:25:16 +0000 |
commit | c8839683871b492772cd355204620a6d11dd59c8 (patch) | |
tree | 8478e39ea07b8e15e93bcc74446b6ddef9bdc286 /searchlib | |
parent | f487ed8464b3f3dfcf7c1ddb03f331073d4e35af (diff) |
Add implementation file.
Diffstat (limited to 'searchlib')
4 files changed, 37 insertions, 7 deletions
diff --git a/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt b/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt index 0698c57246a..5af7bd21d78 100644 --- a/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt @@ -6,5 +6,6 @@ vespa_add_library(searchlib_datastore OBJECT bufferstate.cpp datastore.cpp datastorebase.cpp + entryref.cpp DEPENDS ) diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.cpp b/searchlib/src/vespa/searchlib/datastore/entryref.cpp new file mode 100644 index 00000000000..f7224191d1b --- /dev/null +++ b/searchlib/src/vespa/searchlib/datastore/entryref.cpp @@ -0,0 +1,17 @@ +// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "entryref.hpp" + +namespace search::datastore { + +template EntryRefT<24u, 8u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT<31u, 1u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT<22u,10u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT<19u,13u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT<18u, 6u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT<15u,17u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT<10u,22u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT<10u,10u>::EntryRefT(uint64_t, uint32_t); +template EntryRefT< 3u, 2u>::EntryRefT(uint64_t, uint32_t); + +} diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.h b/searchlib/src/vespa/searchlib/datastore/entryref.h index f4dec5dbef3..457ffac4e26 100644 --- a/searchlib/src/vespa/searchlib/datastore/entryref.h +++ b/searchlib/src/vespa/searchlib/datastore/entryref.h @@ -3,7 +3,6 @@ #pragma once #include <cstdint> -#include <vespa/vespalib/util/assert.h> namespace search::datastore { @@ -28,12 +27,7 @@ template <uint32_t OffsetBits, uint32_t BufferBits = 32u - OffsetBits> class EntryRefT : public EntryRef { public: EntryRefT() : EntryRef() {} - EntryRefT(uint64_t offset_, uint32_t bufferId_) : - EntryRef((offset_ << BufferBits) + bufferId_) - { - ASSERT_ONCE_OR_LOG(offset_ < offsetSize(), "EntryRefT.offset_overflow", 10000); - ASSERT_ONCE_OR_LOG(bufferId_ < numBuffers(), "EntryRefT.bufferId_overflow", 10000); - } + EntryRefT(uint64_t offset_, uint32_t bufferId_); EntryRefT(const EntryRef & ref_) : EntryRef(ref_.ref()) {} uint32_t hash() const { return offset() + (bufferId() << OffsetBits); } uint64_t offset() const { return _ref >> BufferBits; } diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.hpp b/searchlib/src/vespa/searchlib/datastore/entryref.hpp new file mode 100644 index 00000000000..a7bb9f9b3ef --- /dev/null +++ b/searchlib/src/vespa/searchlib/datastore/entryref.hpp @@ -0,0 +1,18 @@ +// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "entryref.h" +#include <vespa/vespalib/util/assert.h> + +namespace search::datastore { + +template <uint32_t OffsetBits, uint32_t BufferBits> +EntryRefT<OffsetBits, BufferBits>::EntryRefT(uint64_t offset_, uint32_t bufferId_) : + EntryRef((offset_ << BufferBits) + bufferId_) +{ + ASSERT_ONCE_OR_LOG(offset_ < offsetSize(), "EntryRefT.offset_overflow", 10000); + ASSERT_ONCE_OR_LOG(bufferId_ < numBuffers(), "EntryRefT.bufferId_overflow", 10000); +} + +} |