summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-02-08 10:47:20 +0100
committerTor Egge <Tor.Egge@broadpark.no>2019-02-08 10:47:20 +0100
commitd7f1e4298067d2a0866738b109e1ad7f92832f68 (patch)
tree675259055f7c793fe9edc687e71ce25b364d1e76 /searchlib
parent373531ebe5a36c6215aef12f8dc040cb63fa1685 (diff)
Replace RefType with EntryRef as local type alias for datastore::EntryRef.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp16
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_attribute.h8
5 files changed, 19 insertions, 19 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp
index e669e31e2cf..13091241809 100644
--- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp
@@ -100,7 +100,7 @@ DenseTensorAttribute::~DenseTensorAttribute()
void
DenseTensorAttribute::setTensor(DocId docId, const Tensor &tensor)
{
- RefType ref = _denseTensorStore.setTensor(
+ EntryRef ref = _denseTensorStore.setTensor(
(_tensorMapper ? *_tensorMapper->map(tensor) : tensor));
setTensorRef(docId, ref);
}
@@ -109,7 +109,7 @@ DenseTensorAttribute::setTensor(DocId docId, const Tensor &tensor)
std::unique_ptr<Tensor>
DenseTensorAttribute::getTensor(DocId docId) const
{
- RefType ref;
+ EntryRef ref;
if (docId < getCommittedDocIdLimit()) {
ref = _refVector[docId];
}
@@ -122,7 +122,7 @@ DenseTensorAttribute::getTensor(DocId docId) const
void
DenseTensorAttribute::getTensor(DocId docId, MutableDenseTensorView &tensor) const
{
- RefType ref;
+ EntryRef ref;
if (docId < getCommittedDocIdLimit()) {
ref = _refVector[docId];
}
@@ -153,7 +153,7 @@ DenseTensorAttribute::onLoad()
tensorReader.readTensor(raw.data, rawLen);
_refVector.push_back(raw.ref);
} else {
- _refVector.push_back(RefType());
+ _refVector.push_back(EntryRef());
}
}
setNumDocs(numDocs);
diff --git a/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp
index 77abe876d87..3ea40433a82 100644
--- a/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp
@@ -49,7 +49,7 @@ GenericTensorAttribute::~GenericTensorAttribute()
void
GenericTensorAttribute::setTensor(DocId docId, const Tensor &tensor)
{
- RefType ref = _genericTensorStore.setTensor(
+ EntryRef ref = _genericTensorStore.setTensor(
(_tensorMapper ? *_tensorMapper->map(tensor) : tensor));
setTensorRef(docId, ref);
}
@@ -58,7 +58,7 @@ GenericTensorAttribute::setTensor(DocId docId, const Tensor &tensor)
std::unique_ptr<Tensor>
GenericTensorAttribute::getTensor(DocId docId) const
{
- RefType ref;
+ EntryRef ref;
if (docId < getCommittedDocIdLimit()) {
ref = _refVector[docId];
}
diff --git a/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp b/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp
index 541ef693d43..6c8edfdc00d 100644
--- a/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp
@@ -107,7 +107,7 @@ GenericTensorStore::getTensor(EntryRef ref) const
"tensor attribute value.",
VESPA_STRLOC);
}
- return std::move(tensor);
+ return tensor;
}
TensorStore::EntryRef
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
index ac7dac0086a..af8c820a3c6 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
@@ -65,9 +65,9 @@ TensorAttribute::asTensorAttribute() const
uint32_t
TensorAttribute::clearDoc(DocId docId)
{
- RefType oldRef(_refVector[docId]);
+ EntryRef oldRef(_refVector[docId]);
updateUncommittedDocIdLimit(docId);
- _refVector[docId] = RefType();
+ _refVector[docId] = EntryRef();
if (oldRef.valid()) {
_tensorStore.holdTensor(oldRef);
return 1u;
@@ -128,7 +128,7 @@ bool
TensorAttribute::addDoc(DocId &docId)
{
bool incGen = _refVector.isFull();
- _refVector.push_back(RefType());
+ _refVector.push_back(EntryRef());
AttributeVector::incNumDocs();
docId = AttributeVector::getNumDocs() - 1;
updateUncommittedDocIdLimit(docId);
@@ -142,14 +142,14 @@ TensorAttribute::addDoc(DocId &docId)
void
-TensorAttribute::setTensorRef(DocId docId, RefType ref)
+TensorAttribute::setTensorRef(DocId docId, EntryRef ref)
{
assert(docId < _refVector.size());
updateUncommittedDocIdLimit(docId);
// TODO: validate if following fence is sufficient.
std::atomic_thread_fence(std::memory_order_release);
- // TODO: Check if refVector must consist of std::atomic<RefType>
- RefType oldRef(_refVector[docId]);
+ // TODO: Check if refVector must consist of std::atomic<EntryRef>
+ EntryRef oldRef(_refVector[docId]);
_refVector[docId] = ref;
if (oldRef.valid()) {
_tensorStore.holdTensor(oldRef);
@@ -174,10 +174,10 @@ TensorAttribute::clearDocs(DocId lidLow, DocId lidLimit)
assert(lidLow <= lidLimit);
assert(lidLimit <= this->getNumDocs());
for (DocId lid = lidLow; lid < lidLimit; ++lid) {
- RefType &ref = _refVector[lid];
+ EntryRef &ref = _refVector[lid];
if (ref.valid()) {
_tensorStore.holdTensor(ref);
- ref = RefType();
+ ref = EntryRef();
}
}
}
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h
index c50ec0b2f72..06758da8063 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h
@@ -16,8 +16,8 @@ namespace search::tensor {
class TensorAttribute : public NotImplementedAttribute, public ITensorAttribute
{
protected:
- using RefType = TensorStore::EntryRef;
- using RefVector = attribute::RcuVectorBase<RefType>;
+ using EntryRef = TensorStore::EntryRef;
+ using RefVector = attribute::RcuVectorBase<EntryRef>;
RefVector _refVector; // docId -> ref in data store for serialized tensor
TensorStore &_tensorStore; // data store for serialized tensors
@@ -26,10 +26,10 @@ protected:
template <typename RefType>
void doCompactWorst();
- void setTensorRef(DocId docId, RefType ref);
+ void setTensorRef(DocId docId, EntryRef ref);
public:
DECLARE_IDENTIFIABLE_ABSTRACT(TensorAttribute);
- using RefCopyVector = vespalib::Array<RefType>;
+ using RefCopyVector = vespalib::Array<EntryRef>;
TensorAttribute(vespalib::stringref name, const Config &cfg, TensorStore &tensorStore);
~TensorAttribute() override;
const ITensorAttribute *asTensorAttribute() const override;