Interface ImpulseGraphSnapshot
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
GraphSnapshot, MockImpulseGraphSnapshot
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intMagic header constant ("IMPS").static final shortMajor spec version.static final shortMinor spec version. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanawaitDrained(long timeout, TimeUnit unit) Awaits all in-flight queries executing against this snapshot to drain, up to the specified timeout.voidclose()default DomainViewBinds an explicit domain anchor context for initiating traversals.default voiddrainAndClose(long timeout, TimeUnit unit) Awaits all in-flight queries to drain and closes the underlying off-heap graph resources.voidvoiddefault longReturns the count of queries currently executing against this graph snapshot.Returns a map of all relation snapshots.getDomainAttributeNames(String domainName) Returns the list of attribute names defined for the given domain.default MemorySegmentgetDomainAttributeSegment(String domainName, String attributeName) Returns the off-heapMemorySegmentfor the given domain attribute.default List<MemorySegment> getDomainAttributeSegments(String domainName) Returns the list of off-heapMemorySegments for all attributes in the given domain.default intgetDomainKeyAttrIndex(String domainName) Returns the 0-indexed attribute index holding the primary key column for the given domain, or 0xFFFF if none.getDomainName(int domainId) Looks up a domain name by its numeric identifier.Returns the set of all domain names present in this snapshot.longgetEdgeCount(String relationName) Returns the edge count for a specific relation.default intReturns the maximum node count across all domains/relations in this snapshot.getMetadata(String key) Returns the value for a custom metadata key, or null if not present.Returns an unmodifiable map of all custom metadata key-value pairs stored in this snapshot.longgetNodeCount(String domainName) Returns the node count for a specific entity/domain type.longReturns the total off-heap memory footprint of this snapshot in bytes.intReturns the total count of relations stored in this snapshot.Returns the set of all relation names present in this snapshot.default RelationSnapshotgetRelationSnapshot(int relationId) Obtains theRelationSnapshotfor the given 0-indexed physical relation ID without string allocation or map lookup.getRelationSnapshot(String relationName) Obtains theRelationSnapshotfor the given relation.default StringgetRelationSourceDomainName(String relationName) Returns the source domain name for the given relation, or null if unknown.default StringgetRelationTargetDomainName(String relationName) Returns the target domain name for the given relation, or null if unknown.getRelationTargetsSegment(String relationName) Obtains the off-heapMemorySegmentfor the given relation's target array.Returns the schema/metadata for a given domain, or null if not present.Returns the SHA-256 checksum hex string calculated over the snapshot sections.default booleanChecks if all queries executing against this snapshot have drained (active count == 0).static ImpulseGraphSnapshotConvenience static method to load a snapshot from a file path using an automatic GC-managed Arena.default ImpulseStatementPrepares a parameterized graph query statement for repeated execution.default Traversal<ImpulseBitSet> traverse(long seed) Traverses from a single scalar seed node ID on domain 0 (or default single domain).default Traversal<ImpulseBitSet> traverse(long... seeds) Traverses from batch seed node IDs on domain 0 (or default single domain).
-
Field Details
-
MAGIC
static final int MAGICMagic header constant ("IMPS").- See Also:
-
SPEC_VERSION_MAJOR
static final short SPEC_VERSION_MAJORMajor spec version.- See Also:
-
SPEC_VERSION_MINOR
static final short SPEC_VERSION_MINORMinor spec version.- See Also:
-
-
Method Details
-
getRelationCount
int getRelationCount()Returns the total count of relations stored in this snapshot. -
getRelationNames
-
getNodeCount
Returns the node count for a specific entity/domain type. -
getEdgeCount
Returns the edge count for a specific relation. -
getRelationTargetsSegment
Obtains the off-heapMemorySegmentfor the given relation's target array. -
getRelationSnapshot
Obtains theRelationSnapshotfor the given relation. -
getRelationSnapshot
Obtains theRelationSnapshotfor 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
-
getDomainName
Looks up a domain name by its numeric identifier.- Returns:
- the domain name, or null if not found
-
getRelationSourceDomainName
-
getRelationTargetDomainName
-
getDomainAttributeNames
-
getDomainAttributeSegment
Returns the off-heapMemorySegmentfor the given domain attribute. -
getDomainAttributeSegments
Returns the list of off-heapMemorySegments for all attributes in the given domain. -
getDomainKeyAttrIndex
Returns the 0-indexed attribute index holding the primary key column for the given domain, or 0xFFFF if none. -
getSchema
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
-
getMetadataMap
-
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
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
Awaits all in-flight queries to drain and closes the underlying off-heap graph resources.- Throws:
InterruptedException
-
domain
Binds an explicit domain anchor context for initiating traversals. -
traverse
Traverses from a single scalar seed node ID on domain 0 (or default single domain). -
traverse
Traverses from batch seed node IDs on domain 0 (or default single domain). -
prepare
Prepares a parameterized graph query statement for repeated execution. -
load
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:
closein interfaceAutoCloseable
-