diff options
author | Henning Baldersheim <balder@oath.com> | 2018-06-14 23:11:10 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-06-14 23:11:10 +0200 |
commit | 9c995cacfe8772cf5b8e617cb47abee2fbd077c6 (patch) | |
tree | 4bf3c6b0b79122a4ac7e92638393c4f5cc2cea1e /document | |
parent | 23583227b115e1160e4149ba43d4f6f3efbdd728 (diff) |
Update after comments from @vekterli
Diffstat (limited to 'document')
15 files changed, 26 insertions, 65 deletions
diff --git a/document/src/vespa/document/update/addvalueupdate.h b/document/src/vespa/document/update/addvalueupdate.h index 16fc0d621d0..015d517c5a1 100644 --- a/document/src/vespa/document/update/addvalueupdate.h +++ b/document/src/vespa/document/update/addvalueupdate.h @@ -62,7 +62,6 @@ public: return *this; } - // ValueUpdate implementation void checkCompatibility(const Field& field) const override; bool applyTo(FieldValue& value) const override; void printXml(XmlOutputStream& xos) const override; @@ -71,7 +70,6 @@ public: AddValueUpdate* clone() const override { return new AddValueUpdate(*this); } DECLARE_IDENTIFIABLE(AddValueUpdate); - }; } // document diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.h b/document/src/vespa/document/update/arithmeticvalueupdate.h index 56e8932c8cd..1f9e33a3c3a 100644 --- a/document/src/vespa/document/update/arithmeticvalueupdate.h +++ b/document/src/vespa/document/update/arithmeticvalueupdate.h @@ -57,10 +57,7 @@ public: bool operator==(const ValueUpdate& other) const override; - /** @return the operator of this arithmetic update. */ Operator getOperator() const { return _operator; } - - /** @return the operand of this arithmetic update. */ double getOperand() const { return _operand; } /** @@ -87,7 +84,6 @@ public: */ long applyTo(int64_t value) const; - // ValueUpdate implementation void checkCompatibility(const Field& field) const override; bool applyTo(FieldValue& value) const override; void printXml(XmlOutputStream& xos) const override; @@ -96,7 +92,6 @@ public: ArithmeticValueUpdate* clone() const override { return new ArithmeticValueUpdate(*this); } DECLARE_IDENTIFIABLE(ArithmeticValueUpdate); - }; } // document diff --git a/document/src/vespa/document/update/assignfieldpathupdate.h b/document/src/vespa/document/update/assignfieldpathupdate.h index 494da69792d..a1349bab96a 100644 --- a/document/src/vespa/document/update/assignfieldpathupdate.h +++ b/document/src/vespa/document/update/assignfieldpathupdate.h @@ -54,4 +54,4 @@ private: bool _createMissingPath; }; -} // ns document +} diff --git a/document/src/vespa/document/update/assignvalueupdate.h b/document/src/vespa/document/update/assignvalueupdate.h index 5f8d36cb4fe..978e61cbb3c 100644 --- a/document/src/vespa/document/update/assignvalueupdate.h +++ b/document/src/vespa/document/update/assignvalueupdate.h @@ -30,20 +30,14 @@ public: bool operator==(const ValueUpdate& other) const override; - /** @return The field value to assign during this update. */ bool hasValue() const { return bool(_value); } const FieldValue& getValue() const { return *_value; } - /** - * Sets the field value to assign during this update. - * @return A reference to this. - */ AssignValueUpdate& setValue(const FieldValue* value) { _value.reset(value ? value->clone() : 0); return *this; } - // ValueUpdate implementation. void checkCompatibility(const Field& field) const override; bool applyTo(FieldValue& value) const override; void printXml(XmlOutputStream& xos) const override; diff --git a/document/src/vespa/document/update/clearvalueupdate.h b/document/src/vespa/document/update/clearvalueupdate.h index f9468d0884a..2ac47deaaf9 100644 --- a/document/src/vespa/document/update/clearvalueupdate.h +++ b/document/src/vespa/document/update/clearvalueupdate.h @@ -19,7 +19,6 @@ public: ClearValueUpdate(const ClearValueUpdate& update) : ValueUpdate(update) {} bool operator==(const ValueUpdate& other) const override; - // ValueUpdate implementation void checkCompatibility(const Field& field) const override; bool applyTo(FieldValue& value) const override; void printXml(XmlOutputStream& xos) const override; @@ -30,5 +29,5 @@ public: DECLARE_IDENTIFIABLE(ClearValueUpdate); }; -} // document +} diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h index b1e93d44bce..b27047e98a2 100644 --- a/document/src/vespa/document/update/documentupdate.h +++ b/document/src/vespa/document/update/documentupdate.h @@ -150,4 +150,5 @@ private: friend VespaDocumentSerializer; }; -} // document +} + diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h index 1f820bb661f..3e19420d0d0 100644 --- a/document/src/vespa/document/update/fieldpathupdate.h +++ b/document/src/vespa/document/update/fieldpathupdate.h @@ -70,21 +70,13 @@ public: virtual uint8_t getSerializedType() const = 0; /** Deserializes and creates a new FieldPathUpdate instance. - * Requires type id to be not yet read. + * Requires type id to be not yet consumed. */ static std::unique_ptr<FieldPathUpdate> createInstance(const DocumentTypeRepo& repo, const DataType &type, nbostream & stream); protected: FieldPathUpdate(stringref fieldPath, stringref whereClause = stringref()); - /** - * Deserializes the given byte buffer into an instance of a FieldPathUpdate - * object. - * - * @param type A data type that describes the content of the buffer. - * @param buffer The byte buffer that contains the serialized object. - * @param version The serialization version of the object to deserialize. - */ virtual void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream); /** @return the datatype of the last path element in the field path */ diff --git a/document/src/vespa/document/update/fieldpathupdates.h b/document/src/vespa/document/update/fieldpathupdates.h index db2da82f705..fb2cf1dffe2 100644 --- a/document/src/vespa/document/update/fieldpathupdates.h +++ b/document/src/vespa/document/update/fieldpathupdates.h @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/document/update/addfieldpathupdate.h> -#include <vespa/document/update/assignfieldpathupdate.h> -#include <vespa/document/update/removefieldpathupdate.h> +#include "addfieldpathupdate.h" +#include "assignfieldpathupdate.h" +#include "removefieldpathupdate.h" diff --git a/document/src/vespa/document/update/fieldupdate.h b/document/src/vespa/document/update/fieldupdate.h index dcfb60ed7e8..9d0b9feabce 100644 --- a/document/src/vespa/document/update/fieldupdate.h +++ b/document/src/vespa/document/update/fieldupdate.h @@ -44,7 +44,6 @@ public: * * @param type A document type that describes the buffer content. * @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); @@ -71,18 +70,8 @@ public: const std::vector<ValueUpdate::CP>& getUpdates() const { return _updates; } const Field& getField() const { return _field; } - - /** - * Applies this update object to the given {@link Document} object. - * - * @param doc The document to apply this update to. - */ void applyTo(Document& doc) const; - - // Printable implementation void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - // XmlSerializable implementation void printXml(XmlOutputStream&) const override; /** @@ -90,7 +79,7 @@ public: * Not a Deserializable, as document type is needed as extra information. * * @param type A document type that describes the buffer content. - * @param buffer The byte buffer that contains the serialized update object. + * @param buffer The stream that contains the serialized update object. */ void deserialize(const DocumentTypeRepo& repo, const DocumentType& type, nbostream& stream); diff --git a/document/src/vespa/document/update/mapvalueupdate.h b/document/src/vespa/document/update/mapvalueupdate.h index d2152bd903c..4e407097405 100644 --- a/document/src/vespa/document/update/mapvalueupdate.h +++ b/document/src/vespa/document/update/mapvalueupdate.h @@ -18,8 +18,6 @@ namespace document { class MapValueUpdate : public ValueUpdate { FieldValue::CP _key; // The field value this update is mapping to. - // This is shared pointer to be able to lookup key - // in weighted set map. ValueUpdate::CP _update; //The update to apply to the value member of this. // Used by ValueUpdate's static factory function @@ -47,11 +45,9 @@ public: bool operator==(const ValueUpdate& other) const override; - /** @return The key of the field value to update. */ const FieldValue& getKey() const { return *_key; } FieldValue& getKey() { return *_key; } - /** @return The update to apply to the field value of this. */ const ValueUpdate& getUpdate() const { return *_update; } ValueUpdate& getUpdate() { return *_update; } @@ -77,7 +73,6 @@ public: return *this; } - // ValueUpdate implementation void checkCompatibility(const Field& field) const override; bool applyTo(FieldValue& value) const override; void printXml(XmlOutputStream& xos) const override; @@ -89,5 +84,5 @@ public: }; -} // document +} diff --git a/document/src/vespa/document/update/removefieldpathupdate.h b/document/src/vespa/document/update/removefieldpathupdate.h index 2a336985909..1329361621e 100644 --- a/document/src/vespa/document/update/removefieldpathupdate.h +++ b/document/src/vespa/document/update/removefieldpathupdate.h @@ -28,4 +28,5 @@ private: std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document &, const DocumentTypeRepo &) const override; }; -} // ns document +} + diff --git a/document/src/vespa/document/update/removevalueupdate.h b/document/src/vespa/document/update/removevalueupdate.h index 4c6befddbf3..c674ebf430c 100644 --- a/document/src/vespa/document/update/removevalueupdate.h +++ b/document/src/vespa/document/update/removevalueupdate.h @@ -46,7 +46,6 @@ public: return *this; } - // ValueUpdate implementation void checkCompatibility(const Field& field) const override; bool applyTo(FieldValue& value) const override; void printXml(XmlOutputStream& xos) const override; @@ -58,5 +57,5 @@ public: }; -} // document +} diff --git a/document/src/vespa/document/update/updates.h b/document/src/vespa/document/update/updates.h index 92cb51699cd..50a6e318b6a 100644 --- a/document/src/vespa/document/update/updates.h +++ b/document/src/vespa/document/update/updates.h @@ -2,13 +2,12 @@ #pragma once -#include <vespa/document/update/documentupdate.h> -#include <vespa/document/update/fieldupdate.h> - -#include <vespa/document/update/addvalueupdate.h> -#include <vespa/document/update/arithmeticvalueupdate.h> -#include <vespa/document/update/assignvalueupdate.h> -#include <vespa/document/update/clearvalueupdate.h> -#include <vespa/document/update/mapvalueupdate.h> -#include <vespa/document/update/removevalueupdate.h> +#include "documentupdate.h" +#include "fieldupdate.h" +#include "addvalueupdate.h" +#include "arithmeticvalueupdate.h" +#include "assignvalueupdate.h" +#include "clearvalueupdate.h" +#include "mapvalueupdate.h" +#include "removevalueupdate.h" diff --git a/document/src/vespa/document/update/valueupdate.cpp b/document/src/vespa/document/update/valueupdate.cpp index e62ae1e9c39..2fe203d8d4b 100644 --- a/document/src/vespa/document/update/valueupdate.cpp +++ b/document/src/vespa/document/update/valueupdate.cpp @@ -20,7 +20,7 @@ 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. - /// Should also use the serializer, not this deserilize into self. + /// Should also use the serializer, not this deserialize into self. update->deserialize(repo, type, stream); return update; } else { diff --git a/document/src/vespa/document/update/valueupdate.h b/document/src/vespa/document/update/valueupdate.h index 2574aa66c0b..80afe39d132 100644 --- a/document/src/vespa/document/update/valueupdate.h +++ b/document/src/vespa/document/update/valueupdate.h @@ -42,7 +42,7 @@ public: * Create a value update object from the given byte buffer. * * @param type A data type that describes the content of the buffer. - * @param buffer The byte buffer that containes the serialized update. + * @param buffer The stream that containes the serialized update. */ static std::unique_ptr<ValueUpdate> createInstance(const DocumentTypeRepo& repo, const DataType& type, nbostream & buffer); @@ -68,8 +68,7 @@ public: * Recursively checks the compatibility of this value update as * applied to the given document field. * - * @throws IllegalArgumentException Thrown if this value update - * is not compatible. + * @throws IllegalArgumentException Thrown if this value update is not compatible. */ virtual void checkCompatibility(const Field& field) const = 0; @@ -86,7 +85,7 @@ public: * Deserializes the given byte buffer into an instance of an update object. * * @param type A data type that describes the content of the buffer. - * @param buffer The byte buffer that contains the serialized update object. + * @param buffer The stream that contains the serialized update object. */ virtual void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream) = 0; @@ -103,5 +102,5 @@ public: DECLARE_IDENTIFIABLE_ABSTRACT(ValueUpdate); }; -} // document +} |