Class LongIdMapper

java.lang.Object
org.impulsegraph.api.LongIdMapper
All Implemented Interfaces:
IdMapper<Long>

public class LongIdMapper extends Object implements IdMapper<Long>
High-performance thread-safe IdMapper for 64-bit Long external keys (e.g. database PKs, Snowflake IDs).
  • Constructor Summary

    Constructors
    Constructor
    Description
    LongIdMapper(String domainType)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all in-memory mappings.
    Obtains the entity/domain name associated with this mapper.
    getExternalKey(long denseId)
    Resolves a local dense node ID back to its external key.
    getId(Long rawId)
    Looks up the dense node ID for a given external key without assigning a new one.
    long
    Resolves an external key to a dense 64-bit node ID, assigning a new ID if absent.
    void
    registerMapping(Long rawId, long denseId)
    Registers a known external key to dense ID mapping (e.g. loaded from binary Section 4 or database).
    int
    Returns the total count of mapped IDs.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LongIdMapper

      public LongIdMapper(String domainType)
  • Method Details

    • getDomainType

      public String getDomainType()
      Description copied from interface: IdMapper
      Obtains the entity/domain name associated with this mapper.
      Specified by:
      getDomainType in interface IdMapper<Long>
    • getOrAssignId

      public long getOrAssignId(Long rawId)
      Description copied from interface: IdMapper
      Resolves an external key to a dense 64-bit node ID, assigning a new ID if absent.
      Specified by:
      getOrAssignId in interface IdMapper<Long>
    • registerMapping

      public void registerMapping(Long rawId, long denseId)
      Description copied from interface: IdMapper
      Registers a known external key to dense ID mapping (e.g. loaded from binary Section 4 or database).
      Specified by:
      registerMapping in interface IdMapper<Long>
    • getExternalKey

      public Long getExternalKey(long denseId)
      Description copied from interface: IdMapper
      Resolves a local dense node ID back to its external key.
      Specified by:
      getExternalKey in interface IdMapper<Long>
    • getId

      public Long getId(Long rawId)
      Description copied from interface: IdMapper
      Looks up the dense node ID for a given external key without assigning a new one. Returns null if absent.
      Specified by:
      getId in interface IdMapper<Long>
    • size

      public int size()
      Description copied from interface: IdMapper
      Returns the total count of mapped IDs.
      Specified by:
      size in interface IdMapper<Long>
    • clear

      public void clear()
      Description copied from interface: IdMapper
      Clears all in-memory mappings.
      Specified by:
      clear in interface IdMapper<Long>