diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-16 22:58:07 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-19 14:13:40 +0000 |
commit | 46de62c8e589ab93ba2fcc49b742d0db612ff214 (patch) | |
tree | 023c8bf6cdaf2226e81f4ea68a7f16b0b64f7bf9 /document/src/main | |
parent | 0180922a9d5a40142b83a17b76e2d7abe52c10bd (diff) |
doc: -> id:
Unify documentid java/cpp
GC old formats v6 and v7
Diffstat (limited to 'document/src/main')
4 files changed, 4 insertions, 58 deletions
diff --git a/document/src/main/java/com/yahoo/document/DocumentUpdate.java b/document/src/main/java/com/yahoo/document/DocumentUpdate.java index ef075662ee7..8de8ca6af53 100644 --- a/document/src/main/java/com/yahoo/document/DocumentUpdate.java +++ b/document/src/main/java/com/yahoo/document/DocumentUpdate.java @@ -31,7 +31,7 @@ import java.util.Optional; * <pre> * DocumentType musicType = DocumentTypeManager.getInstance().getDocumentType("music", 0); * DocumentUpdate docUpdate = new DocumentUpdate(musicType, - * new DocumentId("doc:test:http://music.yahoo.com/")); + * new DocumentId("id:test:music::http://music.yahoo.com/")); * FieldUpdate update = FieldUpdate.createAssign(musicType.getField("artist"), "lillbabs"); * docUpdate.addFieldUpdate(update); * </pre> diff --git a/document/src/main/java/com/yahoo/document/idstring/DocIdString.java b/document/src/main/java/com/yahoo/document/idstring/DocIdString.java deleted file mode 100644 index 09cc27d2c89..00000000000 --- a/document/src/main/java/com/yahoo/document/idstring/DocIdString.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.document.idstring; - -import com.yahoo.collections.MD5; -import com.yahoo.text.Utf8; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * Representation of doc scheme in document IDs. - * - * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a> - */ -//TODO Remove no later than Vespa 8 -@Deprecated -public class DocIdString extends IdString { - /** - * Create a doc scheme object. - * <code>doc:<namespace>:<namespaceSpecific></code> - * - * @param namespace The namespace of this document id. - * @param namespaceSpecific The namespace specific part. - */ - public DocIdString(String namespace, String namespaceSpecific) { - super(Scheme.doc, namespace, namespaceSpecific); - } - - /** - * Get the location of this document id. The location is used for distribution - * in clusters. For the doc scheme, the location is a hash of the whole id. - * - * @return The 64 bit location. - */ - public long getLocation() { - long result = 0; - byte[] md5sum = MD5.md5.get().digest(Utf8.toBytes(toString())); - for (int i=0; i<8; ++i) { - result |= (md5sum[i] & 0xFFl) << (8*i); - } - - return result; - } - - /** Get the scheme specific part. Which is non-existing for doc scheme. */ - public String getSchemeSpecific() { - return ""; - } -} diff --git a/document/src/main/java/com/yahoo/document/idstring/IdString.java b/document/src/main/java/com/yahoo/document/idstring/IdString.java index d988de60cdf..0fe382be914 100644 --- a/document/src/main/java/com/yahoo/document/idstring/IdString.java +++ b/document/src/main/java/com/yahoo/document/idstring/IdString.java @@ -37,7 +37,7 @@ public abstract class IdString { return ""; } - public enum Scheme { doc, id } + public enum Scheme { id } private final Scheme scheme; private final String namespace; private final String namespaceSpecific; @@ -79,7 +79,6 @@ public abstract class IdString { } } - @SuppressWarnings("deprecation") private static IdString parseAndCreate(String id) { String namespace; @@ -121,9 +120,6 @@ public abstract class IdString { currPos = colonPos + 1; return new IdIdString(namespace, type, keyValues, id.substring(currPos)); - - } else if (schemeStr.equals("doc")) { - return new DocIdString(namespace, id.substring(currPos)); } else { throw new IllegalArgumentException("Unknown id scheme '" + schemeStr + "'"); } diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java index ef33fb6b804..e80cebdcc29 100644 --- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java +++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java @@ -120,11 +120,10 @@ public class VespaDocumentDeserializer6 extends BufferSerializer implements Docu dataPos = position(); } - doc.setId(readDocumentId()); - + DocumentId documentId = readDocumentId(); Byte content = getByte(null); - doc.setDataType(readDocumentType()); + doc.setId(documentId); Struct h = doc.getHeader(); Struct b = doc.getBody(); |