aboutsummaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-13 15:07:32 +0200
committerHenning Baldersheim <balder@oath.com>2018-06-14 09:41:07 +0200
commitb4f9a3542b2f66041c6704c1f8e554f5c885f2fe (patch)
tree6e88c61278cc8547d86e6d0bc5c2564e484d7747 /document
parent555b143ec639c9a635d043a6b8d4923c0890d0ac (diff)
Remove unused version from api
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/documentupdatetestcase.cpp6
-rw-r--r--document/src/vespa/document/update/addvalueupdate.cpp7
-rw-r--r--document/src/vespa/document/update/addvalueupdate.h3
-rw-r--r--document/src/vespa/document/update/arithmeticvalueupdate.cpp2
-rw-r--r--document/src/vespa/document/update/arithmeticvalueupdate.h3
-rw-r--r--document/src/vespa/document/update/assignvalueupdate.cpp4
-rw-r--r--document/src/vespa/document/update/assignvalueupdate.h4
-rw-r--r--document/src/vespa/document/update/clearvalueupdate.cpp2
-rw-r--r--document/src/vespa/document/update/clearvalueupdate.h3
-rw-r--r--document/src/vespa/document/update/documentupdate.cpp4
-rw-r--r--document/src/vespa/document/update/fieldupdate.cpp9
-rw-r--r--document/src/vespa/document/update/fieldupdate.h7
-rw-r--r--document/src/vespa/document/update/mapvalueupdate.cpp8
-rw-r--r--document/src/vespa/document/update/mapvalueupdate.h3
-rw-r--r--document/src/vespa/document/update/removevalueupdate.cpp4
-rw-r--r--document/src/vespa/document/update/removevalueupdate.h3
-rw-r--r--document/src/vespa/document/update/valueupdate.cpp5
-rw-r--r--document/src/vespa/document/update/valueupdate.h7
18 files changed, 34 insertions, 50 deletions
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp
index 1f12e5d03f8..eea5dd4decf 100644
--- a/document/src/tests/documentupdatetestcase.cpp
+++ b/document/src/tests/documentupdatetestcase.cpp
@@ -140,9 +140,7 @@ void testValueUpdate(const UpdateType& update, const DataType &type) {
try{
DocumentTypeRepo repo;
nbostream stream = serialize(update);
- typename UpdateType::UP copy(dynamic_cast<UpdateType*>(
- ValueUpdate::createInstance(repo, type, stream, Document::getNewestSerializationVersion())
- .release()));
+ typename UpdateType::UP copy(dynamic_cast<UpdateType*>(ValueUpdate::createInstance(repo, type, stream).release()));
CPPUNIT_ASSERT_EQUAL(update, *copy);
} catch (std::exception& e) {
std::cerr << "Failed while processing update " << update << "\n";
@@ -184,7 +182,7 @@ DocumentUpdateTest::testSimpleUsage() {
FieldUpdate fieldUpdate(docType->getField("intf"));
fieldUpdate.addUpdate(AssignValueUpdate(IntFieldValue(1)));
nbostream stream = serialize(fieldUpdate);
- FieldUpdate fieldUpdateCopy(repo, *docType, stream, Document::getNewestSerializationVersion());
+ FieldUpdate fieldUpdateCopy(repo, *docType, stream);
CPPUNIT_ASSERT_EQUAL(fieldUpdate, fieldUpdateCopy);
// Test that a document update can be serialized
diff --git a/document/src/vespa/document/update/addvalueupdate.cpp b/document/src/vespa/document/update/addvalueupdate.cpp
index 2ea328003fc..d72c12dd26c 100644
--- a/document/src/vespa/document/update/addvalueupdate.cpp
+++ b/document/src/vespa/document/update/addvalueupdate.cpp
@@ -86,15 +86,14 @@ AddValueUpdate::printXml(XmlOutputStream& xos) const
// Deserialize this update from the given buffer.
void
-AddValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream& stream, uint16_t version)
+AddValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream& stream)
{
const CollectionDataType* ctype = Identifiable::cast<const CollectionDataType*>(&type);
- if (ctype == NULL) {
+ if (ctype == nullptr) {
throw DeserializeException("Can not perform add operation on non-collection type.");
}
_value.reset(ctype->getNestedType().createFieldValue().release());
- VespaDocumentDeserializer deserializer(repo, stream, version);
+ VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion());
deserializer.read(*_value);
stream >> _weight;
}
diff --git a/document/src/vespa/document/update/addvalueupdate.h b/document/src/vespa/document/update/addvalueupdate.h
index ba4dfaaaefa..16fc0d621d0 100644
--- a/document/src/vespa/document/update/addvalueupdate.h
+++ b/document/src/vespa/document/update/addvalueupdate.h
@@ -67,8 +67,7 @@ public:
bool applyTo(FieldValue& value) const override;
void printXml(XmlOutputStream& xos) const override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
- void deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream & buffer, uint16_t version) override;
+ void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & buffer) override;
AddValueUpdate* clone() const override { return new AddValueUpdate(*this); }
DECLARE_IDENTIFIABLE(AddValueUpdate);
diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.cpp b/document/src/vespa/document/update/arithmeticvalueupdate.cpp
index 44470c7b541..9ae7dd17a52 100644
--- a/document/src/vespa/document/update/arithmeticvalueupdate.cpp
+++ b/document/src/vespa/document/update/arithmeticvalueupdate.cpp
@@ -127,7 +127,7 @@ ArithmeticValueUpdate::printXml(XmlOutputStream& xos) const
// Deserialize this update from the given buffer.
void
-ArithmeticValueUpdate::deserialize(const DocumentTypeRepo&, const DataType&, nbostream & stream, uint16_t)
+ArithmeticValueUpdate::deserialize(const DocumentTypeRepo&, const DataType&, nbostream & stream)
{
int32_t opt;
stream >> opt >>_operand;
diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.h b/document/src/vespa/document/update/arithmeticvalueupdate.h
index 4990cf3962e..56e8932c8cd 100644
--- a/document/src/vespa/document/update/arithmeticvalueupdate.h
+++ b/document/src/vespa/document/update/arithmeticvalueupdate.h
@@ -92,8 +92,7 @@ public:
bool applyTo(FieldValue& value) const override;
void printXml(XmlOutputStream& xos) const override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
- void deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream & buffer, uint16_t version) override;
+ void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & buffer) override;
ArithmeticValueUpdate* clone() const override { return new ArithmeticValueUpdate(*this); }
DECLARE_IDENTIFIABLE(ArithmeticValueUpdate);
diff --git a/document/src/vespa/document/update/assignvalueupdate.cpp b/document/src/vespa/document/update/assignvalueupdate.cpp
index 3da63e8a5aa..0f7cf243ba3 100644
--- a/document/src/vespa/document/update/assignvalueupdate.cpp
+++ b/document/src/vespa/document/update/assignvalueupdate.cpp
@@ -89,7 +89,7 @@ AssignValueUpdate::printXml(XmlOutputStream& xos) const
// Deserialize this update from the given buffer.
void
-AssignValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream, uint16_t version)
+AssignValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream)
{
// Read content bit vector.
uint8_t content = 0x00;
@@ -98,7 +98,7 @@ AssignValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& typ
// Read field value, if any.
if (content & CONTENT_HASVALUE) {
_value.reset(type.createFieldValue().release());
- VespaDocumentDeserializer deserializer(repo, stream, version);
+ VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion());
deserializer.read(*_value);
}
}
diff --git a/document/src/vespa/document/update/assignvalueupdate.h b/document/src/vespa/document/update/assignvalueupdate.h
index 661a9ed783c..5f8d36cb4fe 100644
--- a/document/src/vespa/document/update/assignvalueupdate.h
+++ b/document/src/vespa/document/update/assignvalueupdate.h
@@ -33,7 +33,6 @@ public:
/** @return The field value to assign during this update. */
bool hasValue() const { return bool(_value); }
const FieldValue& getValue() const { return *_value; }
- const FieldValue* getValuePtr() const { return _value.get(); }
/**
* Sets the field value to assign during this update.
@@ -49,8 +48,7 @@ public:
bool applyTo(FieldValue& value) const override;
void printXml(XmlOutputStream& xos) const override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
- void deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream & buffer, uint16_t version) override;
+ void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & buffer) override;
AssignValueUpdate* clone() const override { return new AssignValueUpdate(*this); }
DECLARE_IDENTIFIABLE(AssignValueUpdate);
diff --git a/document/src/vespa/document/update/clearvalueupdate.cpp b/document/src/vespa/document/update/clearvalueupdate.cpp
index 7335844dadf..e2b8dc86afd 100644
--- a/document/src/vespa/document/update/clearvalueupdate.cpp
+++ b/document/src/vespa/document/update/clearvalueupdate.cpp
@@ -44,7 +44,7 @@ ClearValueUpdate::print(std::ostream& out, bool, const std::string&) const
// Deserialize this update from the given buffer.
void
-ClearValueUpdate::deserialize(const DocumentTypeRepo&, const DataType&, nbostream &, uint16_t)
+ClearValueUpdate::deserialize(const DocumentTypeRepo&, const DataType&, nbostream &)
{
}
diff --git a/document/src/vespa/document/update/clearvalueupdate.h b/document/src/vespa/document/update/clearvalueupdate.h
index f58c6cccf1b..f9468d0884a 100644
--- a/document/src/vespa/document/update/clearvalueupdate.h
+++ b/document/src/vespa/document/update/clearvalueupdate.h
@@ -24,8 +24,7 @@ public:
bool applyTo(FieldValue& value) const override;
void printXml(XmlOutputStream& xos) const override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
- void deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream& buffer, uint16_t version) override;
+ void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream& buffer) override;
ClearValueUpdate* clone() const override { return new ClearValueUpdate(*this); }
DECLARE_IDENTIFIABLE(ClearValueUpdate);
diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp
index e3aee2f3188..7c34740d49a 100644
--- a/document/src/vespa/document/update/documentupdate.cpp
+++ b/document/src/vespa/document/update/documentupdate.cpp
@@ -312,7 +312,7 @@ DocumentUpdate::deserialize42(const DocumentTypeRepo& repo, vespalib::nbostream
int numUpdates = deserializeFlags(sizeAndFlags);
_updates.reserve(numUpdates);
for (int i = 0; i < numUpdates; i++) {
- _updates.emplace_back(repo, *typeAndId.first, stream, _version);
+ _updates.emplace_back(repo, *typeAndId.first, stream);
}
}
} catch (const DeserializeException &) {
@@ -367,7 +367,7 @@ DocumentUpdate::deserializeHEAD(const DocumentTypeRepo &repo, vespalib::nbostrea
stream >> numUpdates;
_updates.reserve(numUpdates);
for (int i = 0; i < numUpdates; i++) {
- _updates.emplace_back(repo, *docType, stream, _version);
+ _updates.emplace_back(repo, *docType, stream);
}
}
// Read fieldpath updates, if any
diff --git a/document/src/vespa/document/update/fieldupdate.cpp b/document/src/vespa/document/update/fieldupdate.cpp
index a4ef3765570..d36a134ecaa 100644
--- a/document/src/vespa/document/update/fieldupdate.cpp
+++ b/document/src/vespa/document/update/fieldupdate.cpp
@@ -27,7 +27,7 @@ int readInt(nbostream & stream) {
}
-FieldUpdate::FieldUpdate(const DocumentTypeRepo& repo, const DataType & type, nbostream & stream, int16_t version)
+FieldUpdate::FieldUpdate(const DocumentTypeRepo& repo, const DataType & type, nbostream & stream)
: Printable(),
_field(type.getField(readInt(stream))),
_updates()
@@ -36,7 +36,7 @@ FieldUpdate::FieldUpdate(const DocumentTypeRepo& repo, const DataType & type, nb
_updates.reserve(numUpdates);
const DataType& dataType = _field.getDataType();
for(int i(0); i < numUpdates; i++) {
- _updates.emplace_back(ValueUpdate::createInstance(repo, dataType, stream, version).release());
+ _updates.emplace_back(ValueUpdate::createInstance(repo, dataType, stream).release());
}
}
@@ -104,8 +104,7 @@ FieldUpdate::print(std::ostream& out, bool verbose, const std::string& indent) c
// Deserialize this field update from the given buffer.
void
-FieldUpdate::deserialize(const DocumentTypeRepo& repo, const DocumentType& docType,
- nbostream& stream, int16_t version)
+FieldUpdate::deserialize(const DocumentTypeRepo& repo, const DocumentType& docType, nbostream& stream)
{
int fieldId = readInt(stream);
_field = docType.getField(fieldId);
@@ -115,7 +114,7 @@ FieldUpdate::deserialize(const DocumentTypeRepo& repo, const DocumentType& docTy
_updates.clear();
_updates.resize(numUpdates);
for(int i = 0; i < numUpdates; i++) {
- _updates[i].reset(ValueUpdate::createInstance(repo, dataType, stream, version).release());
+ _updates[i].reset(ValueUpdate::createInstance(repo, dataType, stream).release());
}
}
diff --git a/document/src/vespa/document/update/fieldupdate.h b/document/src/vespa/document/update/fieldupdate.h
index 0a61ff2de7a..dcfb60ed7e8 100644
--- a/document/src/vespa/document/update/fieldupdate.h
+++ b/document/src/vespa/document/update/fieldupdate.h
@@ -46,8 +46,7 @@ public:
* @param stream A stream that contains a serialized field update.
* @param serializationVersion The serialization version the update was serialized with.
*/
- FieldUpdate(const DocumentTypeRepo& repo, const DataType & type,
- nbostream & stream, int16_t version);
+ FieldUpdate(const DocumentTypeRepo& repo, const DataType & type, nbostream & stream);
bool operator==(const FieldUpdate&) const;
bool operator!=(const FieldUpdate & rhs) const { return ! (*this == rhs); }
@@ -92,10 +91,8 @@ public:
*
* @param type A document type that describes the buffer content.
* @param buffer The byte buffer that contains the serialized update object.
- * @param serializationVersion The serialization version the update was serialized with.
*/
- void deserialize(const DocumentTypeRepo& repo, const DocumentType& type,
- nbostream& stream, int16_t serializationVersion);
+ void deserialize(const DocumentTypeRepo& repo, const DocumentType& type, nbostream& stream);
};
diff --git a/document/src/vespa/document/update/mapvalueupdate.cpp b/document/src/vespa/document/update/mapvalueupdate.cpp
index 3f5f033452e..ff1063a3dda 100644
--- a/document/src/vespa/document/update/mapvalueupdate.cpp
+++ b/document/src/vespa/document/update/mapvalueupdate.cpp
@@ -127,16 +127,16 @@ MapValueUpdate::printXml(XmlOutputStream& xos) const
// Deserialize this update from the given buffer.
void
-MapValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream, uint16_t version)
+MapValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream)
{
- VespaDocumentDeserializer deserializer(repo, stream, version);
+ VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion());
switch(type.getClass().id()) {
case ArrayDataType::classId:
{
_key.reset(new IntFieldValue);
deserializer.read(*_key);
const ArrayDataType& arrayType = static_cast<const ArrayDataType&>(type);
- _update.reset(ValueUpdate::createInstance(repo, arrayType.getNestedType(), stream, version).release());
+ _update.reset(ValueUpdate::createInstance(repo, arrayType.getNestedType(), stream).release());
break;
}
case WeightedSetDataType::classId:
@@ -144,7 +144,7 @@ MapValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type,
const WeightedSetDataType& wset(static_cast<const WeightedSetDataType&>(type));
_key.reset(wset.getNestedType().createFieldValue().release());
deserializer.read(*_key);
- _update.reset(ValueUpdate::createInstance(repo, *DataType::INT, stream, version).release());
+ _update.reset(ValueUpdate::createInstance(repo, *DataType::INT, stream).release());
break;
}
default:
diff --git a/document/src/vespa/document/update/mapvalueupdate.h b/document/src/vespa/document/update/mapvalueupdate.h
index ad1c575bbfe..d2152bd903c 100644
--- a/document/src/vespa/document/update/mapvalueupdate.h
+++ b/document/src/vespa/document/update/mapvalueupdate.h
@@ -82,8 +82,7 @@ public:
bool applyTo(FieldValue& value) const override;
void printXml(XmlOutputStream& xos) const override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
- void deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream& buffer, uint16_t version) override;
+ void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream& buffer) override;
MapValueUpdate* clone() const override { return new MapValueUpdate(*this); }
DECLARE_IDENTIFIABLE(MapValueUpdate);
diff --git a/document/src/vespa/document/update/removevalueupdate.cpp b/document/src/vespa/document/update/removevalueupdate.cpp
index 07f7293af0c..28c69652a0e 100644
--- a/document/src/vespa/document/update/removevalueupdate.cpp
+++ b/document/src/vespa/document/update/removevalueupdate.cpp
@@ -84,7 +84,7 @@ RemoveValueUpdate::print(std::ostream& out, bool, const std::string&) const
// Deserialize this update from the given buffer.
void
-RemoveValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream, uint16_t version)
+RemoveValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream)
{
switch(type.getClass().id()) {
case ArrayDataType::classId:
@@ -92,7 +92,7 @@ RemoveValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& typ
{
const CollectionDataType& c(static_cast<const CollectionDataType&>(type));
_key.reset(c.getNestedType().createFieldValue().release());
- VespaDocumentDeserializer deserializer(repo, stream, version);
+ VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion());
deserializer.read(*_key);
break;
}
diff --git a/document/src/vespa/document/update/removevalueupdate.h b/document/src/vespa/document/update/removevalueupdate.h
index 718c30781d8..4c6befddbf3 100644
--- a/document/src/vespa/document/update/removevalueupdate.h
+++ b/document/src/vespa/document/update/removevalueupdate.h
@@ -51,8 +51,7 @@ public:
bool applyTo(FieldValue& value) const override;
void printXml(XmlOutputStream& xos) const override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
- void deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream& buffer, uint16_t version) override;
+ void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream& buffer) override;
RemoveValueUpdate* clone() const override { return new RemoveValueUpdate(*this); }
DECLARE_IDENTIFIABLE(RemoveValueUpdate);
diff --git a/document/src/vespa/document/update/valueupdate.cpp b/document/src/vespa/document/update/valueupdate.cpp
index 735b637840e..e62ae1e9c39 100644
--- a/document/src/vespa/document/update/valueupdate.cpp
+++ b/document/src/vespa/document/update/valueupdate.cpp
@@ -11,7 +11,7 @@ IMPLEMENT_IDENTIFIABLE_ABSTRACT(ValueUpdate, Identifiable);
// Create a value update from a byte buffer.
std::unique_ptr<ValueUpdate>
-ValueUpdate::createInstance(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream, int serializationVersion)
+ValueUpdate::createInstance(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream)
{
int32_t classId = 0;
stream >> classId;
@@ -20,7 +20,8 @@ ValueUpdate::createInstance(const DocumentTypeRepo& repo, const DataType& type,
if (rtc != nullptr) {
std::unique_ptr<ValueUpdate> update(static_cast<ValueUpdate*>(rtc->create()));
/// \todo TODO (was warning): Updates are not versioned in serialization format. Will not work without altering it.
- update->deserialize(repo, type, stream, serializationVersion);
+ /// Should also use the serializer, not this deserilize into self.
+ update->deserialize(repo, type, stream);
return update;
} else {
throw std::runtime_error(vespalib::make_string("Could not find a class for classId %d(%x)", classId, classId));
diff --git a/document/src/vespa/document/update/valueupdate.h b/document/src/vespa/document/update/valueupdate.h
index fffa9e2035b..2574aa66c0b 100644
--- a/document/src/vespa/document/update/valueupdate.h
+++ b/document/src/vespa/document/update/valueupdate.h
@@ -44,8 +44,7 @@ public:
* @param type A data type that describes the content of the buffer.
* @param buffer The byte buffer that containes the serialized update.
*/
- static std::unique_ptr<ValueUpdate> createInstance(const DocumentTypeRepo& repo, const DataType& type,
- nbostream & buffer, int serializationVersion);
+ static std::unique_ptr<ValueUpdate> createInstance(const DocumentTypeRepo& repo, const DataType& type, nbostream & buffer);
/** Define all types of value updates. */
enum ValueUpdateType {
@@ -88,10 +87,8 @@ public:
*
* @param type A data type that describes the content of the buffer.
* @param buffer The byte buffer that contains the serialized update object.
- * @param version The serialization version of the object to deserialize.
*/
- virtual void deserialize(const DocumentTypeRepo& repo, const DataType& type,
- nbostream & stream, uint16_t version) = 0;
+ virtual void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream) = 0;
/** @return The operation type. */
ValueUpdateType getType() const {