Oid

Oid is the unique identifier of an object within a universe.

Representation

Oid can be represented by the following structure:

struct Oid {
    uint64 set;
    uint64 id;
}

Fields

TypeFieldDescription
uint64setThe set ID.
uint64idThe object ID.

ID

Both the set and the object ID are represented as 64-bit unsigned integers (uint64).

The valid range for an ID is [1, 2^64 - 2].

Two special values are reserved for specific purposes:

  • uint64::MIN (0): Serves as a wildcard, indicating any valid ID.
  • uint64::MAX (2^64 - 1): Represents infinity or total.

Encoding

Oid can be encoded as a uint128:

(uint128(set) << 64) | uint128(id)

Written Format

Oid is typically written in dot-decimal format, like {set}.{id}.

For example:

  • 17.1: Represents the object with ID 1 within set 17.

For meta objects, the {set}. can be replaced with its name:

  • kind 1: Represents the kind object with ID 1 within the set of kinds.
  • relation 17: Represents the relation object with ID 17 within the set of relations.