Package com.yahoo.document
Class GlobalId
java.lang.Object
com.yahoo.document.GlobalId
- All Implemented Interfaces:
Comparable<GlobalId>
Implements an incredibly light-weight version of the document global id. There is a lot of functionality in the C++
version of this that is missing. However, this should be sufficient for now.
This is immutable (by contract - not enforcable due to exposing the raw byte array).
- Author:
- Simon Thoresen Hult
-
Field Summary
-
Constructor Summary
ConstructorDescriptionGlobalId
(byte[] raw) Constructs a new global id by copying the content of the given raw byte array.Constructs a new global id from a document id string.GlobalId
(com.yahoo.vespa.objects.Deserializer buf) Constructs a global id by deserializing content from the given byte buffer. -
Method Summary
-
Field Details
-
LENGTH
public static final int LENGTHThe number of bytes in a global id. This must match the C++ constant in "document/base/globalid.h".- See Also:
-
-
Constructor Details
-
GlobalId
public GlobalId(byte[] raw) Constructs a new global id by copying the content of the given raw byte array.- Parameters:
raw
- The array to copy.
-
GlobalId
Constructs a new global id from a document id string.- Parameters:
id
- the document id to derive from
-
GlobalId
public GlobalId(com.yahoo.vespa.objects.Deserializer buf) Constructs a global id by deserializing content from the given byte buffer.- Parameters:
buf
- the buffer to deserialize from
-
-
Method Details
-
serialize
public void serialize(com.yahoo.vespa.objects.Serializer buf) Serializes the content of this global id into the given byte buffer.- Parameters:
buf
- the buffer to serialize to
-
getRawId
public byte[] getRawId()Returns the raw byte array that constitutes this global id. The returned value MUST NOT be modified. -
hashCode
public int hashCode() -
toBucketId
-
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<GlobalId>
-
toString
-