diff options
author | Henning Baldersheim <balder@oath.com> | 2018-05-30 21:49:01 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-05-31 13:48:59 +0200 |
commit | 51d9070a1184af82b85dafb6c8f2dd6d6b635c2e (patch) | |
tree | 015918e634d1ee112af117b09aeda2c87eacf7af | |
parent | 4b97af420a3b0b6842e51e0ee1a8481e81050d66 (diff) |
Though shall never produce old format again, except from tests.
6 files changed, 11 insertions, 65 deletions
diff --git a/document/src/vespa/document/serialization/vespadocumentserializer.h b/document/src/vespa/document/serialization/vespadocumentserializer.h index 3b0fe581c9e..818759d35b5 100644 --- a/document/src/vespa/document/serialization/vespadocumentserializer.h +++ b/document/src/vespa/document/serialization/vespadocumentserializer.h @@ -76,7 +76,7 @@ private: void write(const AssignFieldPathUpdate &value); void write(const RemoveFieldPathUpdate &value); - void visit(const DocumentUpdate &value) override { write42(value); } + void visit(const DocumentUpdate &value) override { writeHEAD(value); } void visit(const FieldUpdate &value) override { write(value); } void visit(const RemoveValueUpdate &value) override { write(value); } void visit(const AddValueUpdate &value) override { write(value); } diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp index c4e8213f1df..a5e25afbcb3 100644 --- a/document/src/vespa/document/update/documentupdate.cpp +++ b/document/src/vespa/document/update/documentupdate.cpp @@ -159,13 +159,6 @@ DocumentUpdate::applyTo(Document& doc) const } void -DocumentUpdate::serialize42(nbostream &stream) const -{ - VespaDocumentSerializer serializer(stream); - serializer.write42(*this); -} - -void DocumentUpdate::serializeHEAD(nbostream &stream) const { VespaDocumentSerializer serializer(stream); diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h index 759e0131694..839847ed175 100644 --- a/document/src/vespa/document/update/documentupdate.h +++ b/document/src/vespa/document/update/documentupdate.h @@ -133,7 +133,6 @@ public: void deserialize42(const DocumentTypeRepo&, ByteBuffer&); void deserializeHEAD(const DocumentTypeRepo&, ByteBuffer&); - void serialize42(vespalib::nbostream &stream) const; void serializeHEAD(vespalib::nbostream &stream) const; void printXml(XmlOutputStream&) const override; diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp index beaf719dc5c..de5c54bafa0 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp @@ -50,11 +50,7 @@ UpdateOperation::UpdateOperation(const BucketId &bucketId, void UpdateOperation::serializeUpdate(vespalib::nbostream &os) const { - if (getType() == FeedOperation::UPDATE_42) { - _upd->serialize42(os); - } else { - _upd->serializeHEAD(os); - } + _upd->serializeHEAD(os); } void diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h index 7886231af82..0741357678a 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h @@ -15,8 +15,7 @@ class UpdateOperation : public DocumentOperation private: using DocumentUpdateSP = std::shared_ptr<document::DocumentUpdate>; DocumentUpdateSP _upd; - UpdateOperation(Type type, - const document::BucketId &bucketId, + UpdateOperation(Type type, const document::BucketId &bucketId, const storage::spi::Timestamp ×tamp, const DocumentUpdateSP &upd); void serializeUpdate(vespalib::nbostream &os) const; @@ -27,12 +26,12 @@ public: UpdateOperation(const document::BucketId &bucketId, const storage::spi::Timestamp ×tamp, const DocumentUpdateSP &upd); - virtual ~UpdateOperation() {} + ~UpdateOperation() override {} const DocumentUpdateSP &getUpdate() const { return _upd; } void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; void deserializeUpdate(const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const override; + vespalib::string toString() const override; static UpdateOperation makeOldUpdate(const document::BucketId &bucketId, const storage::spi::Timestamp ×tamp, const DocumentUpdateSP &upd); diff --git a/storageapi/src/vespa/storageapi/mbusprot/serializationhelper.h b/storageapi/src/vespa/storageapi/mbusprot/serializationhelper.h index 02c4c0ce0b9..08cec601cce 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/serializationhelper.h +++ b/storageapi/src/vespa/storageapi/mbusprot/serializationhelper.h @@ -4,13 +4,11 @@ #include <vespa/fastos/types.h> #include <vespa/document/base/globalid.h> #include <vespa/document/fieldvalue/document.h> -#include <vespa/document/update/documentupdate.h> #include <vespa/document/util/bytebuffer.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/growablebytebuffer.h> -namespace storage { -namespace mbusprot { +namespace storage::mbusprot { class SerializationHelper { @@ -60,8 +58,7 @@ public: return api::ReturnCode(result, message); } - static void putReturnCode(const api::ReturnCode& code, - vespalib::GrowableByteBuffer& buf) + static void putReturnCode(const api::ReturnCode& code, vespalib::GrowableByteBuffer& buf) { buf.putInt(code.getResult()); buf.putString(code.getMessage()); @@ -77,18 +74,14 @@ public: return document::GlobalId(&buffer[0]); } - static void putGlobalId(const document::GlobalId& gid, - vespalib::GrowableByteBuffer& buf) + static void putGlobalId(const document::GlobalId& gid, vespalib::GrowableByteBuffer& buf) { buf.putShort(document::GlobalId::LENGTH); for (uint32_t i=0; i<document::GlobalId::LENGTH; ++i) { buf.putByte(gid.get()[i]); } } - - static document::Document::UP getDocument( - document::ByteBuffer& buf, - const document::DocumentTypeRepo& repo) + static document::Document::UP getDocument(document::ByteBuffer& buf, const document::DocumentTypeRepo& repo) { uint32_t size = getInt(buf); if (size == 0) { @@ -100,26 +93,7 @@ public: } } - static document::DocumentUpdate::UP getUpdate( - document::ByteBuffer& buf, - const document::DocumentTypeRepo& repo) - { - uint32_t size = getInt(buf); - if (size == 0) { - return document::DocumentUpdate::UP(); - } else { - document::ByteBuffer bbuf(buf.getBufferAtPos(), size); - buf.incPos(size); - return document::DocumentUpdate::UP( - new document::DocumentUpdate(repo, bbuf, - document::DocumentUpdate:: - SerializeVersion:: - SERIALIZE_42)); - } - } - - static void putDocument(document::Document* doc, - vespalib::GrowableByteBuffer& buf) + static void putDocument(document::Document* doc, vespalib::GrowableByteBuffer& buf) { if (doc) { vespalib::nbostream stream; @@ -131,21 +105,6 @@ public: } } - static void putUpdate(document::DocumentUpdate* update, - vespalib::GrowableByteBuffer& buf) - { - if (update) { - vespalib::nbostream stream; - update->serialize42(stream); - buf.putInt(stream.size()); - buf.putBytes(stream.peek(), stream.size()); - } else { - buf.putInt(0); - } - } - }; -} // mbusprot -} // storage - +} |