Package com.yahoo.document
Class GlobalId
- java.lang.Object
-
- com.yahoo.document.GlobalId
-
- All Implemented Interfaces:
Comparable
public class GlobalId extends Object implements Comparable
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
Fields Modifier and Type Field Description static int
LENGTH
The number of bytes in a global id.
-
Constructor Summary
Constructors Constructor Description GlobalId(byte[] raw)
Constructs a new global id by copying the content of the given raw byte array.GlobalId(IdString id)
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
boolean
equals(Object obj)
byte[]
getRawId()
Returns the raw byte array that constitutes this global id.int
hashCode()
void
serialize(com.yahoo.vespa.objects.Serializer buf)
Serializes the content of this global id into the given byte buffer.BucketId
toBucketId()
String
toString()
-
-
-
Field Detail
-
LENGTH
public static final int LENGTH
The number of bytes in a global id. This must match the C++ constant in "document/base/globalid.h".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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
public GlobalId(IdString id)
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 Detail
-
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.
-
toBucketId
public BucketId toBucketId()
-
compareTo
public int compareTo(Object o)
- Specified by:
compareTo
in interfaceComparable
-
-