diff options
author | Henning Baldersheim <balder@oath.com> | 2018-05-29 22:34:22 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-05-29 22:34:22 +0200 |
commit | 7c7b5016dcf6cdf540e78f5902baa0a4669e1a46 (patch) | |
tree | d77e51c842e04ce4b12f3bb7b691b89d53667ac2 /document/src | |
parent | a364dea87f200335cf1e68d61b87820eda4019b7 (diff) |
Remove unused code, and code only used in unit tests for obsolete features.
Diffstat (limited to 'document/src')
6 files changed, 2 insertions, 54 deletions
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index b6aca1ec8be..b9aae3cb3f6 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -200,8 +200,6 @@ DocumentUpdateTest::testSimpleUsage() { ByteBuffer::UP docBuf = serialize42(docUpdate); docBuf->flip(); DocumentUpdate::UP docUpdateCopy(DocumentUpdate::create42(repo, *docBuf)); - CPPUNIT_ASSERT(!docUpdate.affectsDocumentBody()); - CPPUNIT_ASSERT(!docUpdateCopy->affectsDocumentBody()); // Create a test document Document doc(*docType, DocumentId("doc::testdoc")); @@ -252,7 +250,6 @@ DocumentUpdateTest::testSimpleUsage() { updated.getValue("intarr").release())); CPPUNIT_ASSERT_EQUAL(size_t(3), val->size()); CPPUNIT_ASSERT_EQUAL(4, (*val)[2].getAsInt()); - CPPUNIT_ASSERT(upd.affectsDocumentBody()); } { Document updated(doc); diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp index 89f9c0dab67..7058af95828 100644 --- a/document/src/tests/fieldpathupdatetestcase.cpp +++ b/document/src/tests/fieldpathupdatetestcase.cpp @@ -221,12 +221,10 @@ ByteBuffer::UP serializeHEAD(const DocumentUpdate & update) void testSerialize(const DocumentTypeRepo& repo, const DocumentUpdate& a) { try{ - bool affectsBody = a.affectsDocumentBody(); ByteBuffer::UP bb(serializeHEAD(a)); bb->flip(); DocumentUpdate::UP b(DocumentUpdate::createHEAD(repo, *bb)); - CPPUNIT_ASSERT_EQUAL(affectsBody, b->affectsDocumentBody()); CPPUNIT_ASSERT_EQUAL(size_t(0), bb->getRemaining()); CPPUNIT_ASSERT_EQUAL(a.getId().toString(), b->getId().toString()); CPPUNIT_ASSERT_EQUAL(a.getUpdates().size(), b->getUpdates().size()); @@ -1021,13 +1019,11 @@ FieldPathUpdateTestCase::testAffectsDocumentBody() // structmap is body field { DocumentUpdate docUp(_foobar_type, DocumentId("doc:barbar:foofoo")); - CPPUNIT_ASSERT(!docUp.affectsDocumentBody()); FieldPathUpdate::CP update1(new AssignFieldPathUpdate(*doc->getDataType(), "structmap{janitor}", std::string(), fv4)); static_cast<AssignFieldPathUpdate&>(*update1).setCreateMissingPath(true); docUp.addFieldPathUpdate(update1); - CPPUNIT_ASSERT(docUp.affectsDocumentBody()); } // strfoo is header field @@ -1037,7 +1033,6 @@ FieldPathUpdateTestCase::testAffectsDocumentBody() "strfoo", std::string(), StringFieldValue("helloworld"))); static_cast<AssignFieldPathUpdate&>(*update1).setCreateMissingPath(true); docUp.addFieldPathUpdate(update1); - CPPUNIT_ASSERT(!docUp.affectsDocumentBody()); } } @@ -1070,7 +1065,6 @@ FieldPathUpdateTestCase::testSerializeAssign() val.setValue("rating", IntFieldValue(100)); DocumentUpdate docUp(_foobar_type, DocumentId("doc:barbar:foofoo")); - CPPUNIT_ASSERT(!docUp.affectsDocumentBody()); FieldPathUpdate::CP update1(new AssignFieldPathUpdate(*doc->getDataType(), "structmap{ribbit}", "true", val)); static_cast<AssignFieldPathUpdate&>(*update1).setCreateMissingPath(true); @@ -1091,7 +1085,6 @@ FieldPathUpdateTestCase::testSerializeAdd() adds.add(StringFieldValue("george is getting upset!")); DocumentUpdate docUp(_foobar_type, DocumentId("doc:barbar:foofoo")); - CPPUNIT_ASSERT(!docUp.affectsDocumentBody()); FieldPathUpdate::CP update1(new AddFieldPathUpdate(*doc->getDataType(), "strarray", std::string(), adds)); docUp.addFieldPathUpdate(update1); @@ -1106,7 +1099,6 @@ FieldPathUpdateTestCase::testSerializeRemove() MapFieldValue mfv(doc->getType().getField("structmap").getDataType()); DocumentUpdate docUp(_foobar_type, DocumentId("doc:barbar:foofoo")); - CPPUNIT_ASSERT(!docUp.affectsDocumentBody()); FieldPathUpdate::CP update1(new RemoveFieldPathUpdate("structmap{ribbit}", std::string())); docUp.addFieldPathUpdate(update1); diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp index fa289ab0bfa..8d497378ca4 100644 --- a/document/src/vespa/document/update/documentupdate.cpp +++ b/document/src/vespa/document/update/documentupdate.cpp @@ -72,7 +72,7 @@ DocumentUpdate::DocumentUpdate(const DocumentTypeRepo& repo, } } -DocumentUpdate::~DocumentUpdate() { } +DocumentUpdate::~DocumentUpdate() = default; bool @@ -92,22 +92,6 @@ DocumentUpdate::operator==(const DocumentUpdate& other) const return true; } -bool -DocumentUpdate::affectsDocumentBody() const -{ - for(const auto & update : _updates) { - if (!update.getField().isHeaderField()) { - return true; - } - } - for (const auto & update : _fieldPathUpdates) { - if (update->affectsDocumentBody(*_type)) { - return true; - } - } - return false; -} - const DocumentType& DocumentUpdate::getType() const { return static_cast<const DocumentType &> (*_type); @@ -333,13 +317,6 @@ DocumentUpdate::deserializeFlags(int sizeAndFlags) } void -DocumentUpdate::onDeserialize42(const DocumentTypeRepo &repo, - ByteBuffer& buffer) -{ - deserialize42(repo, buffer); -} - -void DocumentUpdate::printXml(XmlOutputStream& xos) const { xos << XmlTag("document") diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h index e6c39278ee2..493dc0f2410 100644 --- a/document/src/vespa/document/update/documentupdate.h +++ b/document/src/vespa/document/update/documentupdate.h @@ -131,8 +131,6 @@ public: /** @return The list of fieldpath updates. */ const FieldPathUpdateV & getFieldPathUpdates() const { return _fieldPathUpdates; } - bool affectsDocumentBody() const; - /** @return The type of document this update is for. */ const DocumentType& getType() const; @@ -141,9 +139,6 @@ public: void deserialize42(const DocumentTypeRepo&, ByteBuffer&); void deserializeHEAD(const DocumentTypeRepo&, ByteBuffer&); - // Deserializable implementation. Kept as search relies on it currently. - virtual void onDeserialize42(const DocumentTypeRepo &repo, ByteBuffer&); - void serialize42(vespalib::nbostream &stream) const; void serializeHEAD(vespalib::nbostream &stream) const; diff --git a/document/src/vespa/document/update/fieldpathupdate.cpp b/document/src/vespa/document/update/fieldpathupdate.cpp index 7265329d4d5..239ffff2fef 100644 --- a/document/src/vespa/document/update/fieldpathupdate.cpp +++ b/document/src/vespa/document/update/fieldpathupdate.cpp @@ -45,7 +45,7 @@ FieldPathUpdate::FieldPathUpdate(stringref fieldPath, stringref whereClause) : _originalWhereClause(whereClause) { } -FieldPathUpdate::~FieldPathUpdate() { } +FieldPathUpdate::~FieldPathUpdate() = default; bool FieldPathUpdate::operator==(const FieldPathUpdate& other) const @@ -76,16 +76,6 @@ FieldPathUpdate::applyTo(Document& doc) const } } -bool -FieldPathUpdate::affectsDocumentBody(const DataType & type) const -{ - FieldPath path; - type.buildFieldPath(path, _originalFieldPath); - if (path.empty() || !path[0].hasField()) return false; - const Field& field = path[0].getFieldRef(); - return !field.isHeaderField(); -} - void FieldPathUpdate::print(std::ostream& out, bool, const std::string& indent) const { diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h index c120c8d3979..6629aa74aee 100644 --- a/document/src/vespa/document/update/fieldpathupdate.h +++ b/document/src/vespa/document/update/fieldpathupdate.h @@ -64,9 +64,6 @@ public: */ void checkCompatibility(const FieldValue& fv, const DataType & type) const; - /** @return Whether or not the first field path element is a body field */ - bool affectsDocumentBody(const DataType & type) const; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_IDENTIFIABLE_ABSTRACT(FieldPathUpdate); |