Class 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 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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toBucketId

        public BucketId toBucketId()