Interface ImpulseGraphSnapshot

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
GraphSnapshot, MockImpulseGraphSnapshot

public interface ImpulseGraphSnapshot extends AutoCloseable
Read-only binary snapshot interface for querying immutable graph snapshots. Backed by memory-mapped off-heap files conforming to C-ABI Binary Snapshot Spec v0.9.0.
  • Field Details

    • MAGIC

      static final int MAGIC
      Magic header constant ("IMPS").
      See Also:
    • SPEC_VERSION_MAJOR

      static final short SPEC_VERSION_MAJOR
      Major spec version.
      See Also:
    • SPEC_VERSION_MINOR

      static final short SPEC_VERSION_MINOR
      Minor spec version.
      See Also:
  • Method Details

    • getRelationCount

      int getRelationCount()
      Returns the total count of relations stored in this snapshot.
    • getRelationNames

      Set<String> getRelationNames()
      Returns the set of all relation names present in this snapshot.
    • getNodeCount

      long getNodeCount(String domainName)
      Returns the node count for a specific entity/domain type.
    • getEdgeCount

      long getEdgeCount(String relationName)
      Returns the edge count for a specific relation.
    • getRelationTargetsSegment

      MemorySegment getRelationTargetsSegment(String relationName)
      Obtains the off-heap MemorySegment for the given relation's target array.
    • getRelationSnapshot

      RelationSnapshot getRelationSnapshot(String relationName)
      Obtains the RelationSnapshot for the given relation.
    • getRelationSnapshot

      default RelationSnapshot getRelationSnapshot(int relationId)
      Obtains the RelationSnapshot for the given 0-indexed physical relation ID without string allocation or map lookup.
    • getMaxNodeCount

      default int getMaxNodeCount()
      Returns the maximum node count across all domains/relations in this snapshot.
    • getAllRelationSnapshots

      Map<String, RelationSnapshot> getAllRelationSnapshots()
      Returns a map of all relation snapshots.
    • getDomainNames

      Set<String> getDomainNames()
      Returns the set of all domain names present in this snapshot.
    • getDomainName

      String getDomainName(int domainId)
      Looks up a domain name by its numeric identifier.
      Returns:
      the domain name, or null if not found
    • getRelationSourceDomainName

      default String getRelationSourceDomainName(String relationName)
      Returns the source domain name for the given relation, or null if unknown.
    • getRelationTargetDomainName

      default String getRelationTargetDomainName(String relationName)
      Returns the target domain name for the given relation, or null if unknown.
    • getDomainAttributeNames

      default List<String> getDomainAttributeNames(String domainName)
      Returns the list of attribute names defined for the given domain.
    • getDomainAttributeSegment

      default MemorySegment getDomainAttributeSegment(String domainName, String attributeName)
      Returns the off-heap MemorySegment for the given domain attribute.
    • getDomainAttributeSegments

      default List<MemorySegment> getDomainAttributeSegments(String domainName)
      Returns the list of off-heap MemorySegments for all attributes in the given domain.
    • getDomainKeyAttrIndex

      default int getDomainKeyAttrIndex(String domainName)
      Returns the 0-indexed attribute index holding the primary key column for the given domain, or 0xFFFF if none.
    • getSchema

      GraphSchema getSchema(String domainName)
      Returns the schema/metadata for a given domain, or null if not present.
    • getGraphStatistics

      GraphStatistics getGraphStatistics()
    • enterQuery

      void enterQuery()
    • exitQuery

      void exitQuery()
    • getOffHeapMemorySizeBytes

      long getOffHeapMemorySizeBytes()
      Returns the total off-heap memory footprint of this snapshot in bytes.
    • getSha256Checksum

      String getSha256Checksum()
      Returns the SHA-256 checksum hex string calculated over the snapshot sections.
    • getMetadata

      String getMetadata(String key)
      Returns the value for a custom metadata key, or null if not present.
    • getMetadataMap

      Map<String,String> getMetadataMap()
      Returns an unmodifiable map of all custom metadata key-value pairs stored in this snapshot.
    • getActiveQueryCount

      default long getActiveQueryCount()
      Returns the count of queries currently executing against this graph snapshot.
    • isDrained

      default boolean isDrained()
      Checks if all queries executing against this snapshot have drained (active count == 0).
    • awaitDrained

      default boolean awaitDrained(long timeout, TimeUnit unit) throws InterruptedException
      Awaits all in-flight queries executing against this snapshot to drain, up to the specified timeout.
      Returns:
      true if all queries drained; false if timeout expired
      Throws:
      InterruptedException
    • drainAndClose

      default void drainAndClose(long timeout, TimeUnit unit) throws InterruptedException
      Awaits all in-flight queries to drain and closes the underlying off-heap graph resources.
      Throws:
      InterruptedException
    • domain

      default DomainView domain(String domainName)
      Binds an explicit domain anchor context for initiating traversals.
    • traverse

      default Traversal<ImpulseBitSet> traverse(long seed)
      Traverses from a single scalar seed node ID on domain 0 (or default single domain).
    • traverse

      default Traversal<ImpulseBitSet> traverse(long... seeds)
      Traverses from batch seed node IDs on domain 0 (or default single domain).
    • prepare

      default ImpulseStatement prepare(String query)
      Prepares a parameterized graph query statement for repeated execution.
    • load

      static ImpulseGraphSnapshot load(Path path)
      Convenience static method to load a snapshot from a file path using an automatic GC-managed Arena. WARNING: Intended for scripting and short-lived tools. Multi-GB snapshots in long-running processes should use explicitly managed Arenas to prevent virtual memory exhaustion.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable