@ultipa-graph/ultipa-driver
Version:
NodeJS SDK for Ultipa GQL
121 lines (120 loc) • 2.92 kB
TypeScript
/**
* Metadata types for GQLDB Node.js driver.
*/
import { GraphType } from './enums';
/** Information about a graph */
export interface GraphInfo {
name: string;
graphType: GraphType;
nodeCount: number;
edgeCount: number;
description: string;
}
/** Information about a transaction */
export interface TransactionInfo {
transactionId: number;
sessionId: number;
graphName: string;
readOnly: boolean;
createdAt: number;
durationMs: number;
internalTxId: string;
}
/**
* One row from `SHOW TRANSACTIONS` (admin DDL added by transaction-branch).
* `sessionId` is `''` when the server has not auto-derived one from peer
* info and the driver has not surfaced explicit `x-ultipa-session-id`
* metadata. See TRANSACTIONS_DRIVER_GUIDE.md §3.1.
*/
export interface TransactionRow {
transactionId: string;
status: string;
readOnly: boolean;
startTime: string;
sessionId: string;
}
/** AST cache statistics */
export interface ASTCacheStats {
hits: number;
misses: number;
evictions: number;
entries: number;
hitRate: number;
}
/** Plan cache statistics */
export interface PlanCacheStats {
size: number;
capacity: number;
hits: number;
misses: number;
hitRate: number;
}
/** Combined cache statistics */
export interface CacheStats {
astStats?: ASTCacheStats;
planStats?: PlanCacheStats;
}
/** Database statistics */
export interface Statistics {
nodeCount: number;
edgeCount: number;
labelCounts: Record<string, number>;
edgeLabelCounts: Record<string, number>;
}
/** CPU metrics */
export interface CpuMetrics {
processPercent: number;
systemPercent: number;
numCores: number;
}
/** Memory metrics */
export interface MemoryMetrics {
processRss: number;
heapAlloc: number;
heapSys: number;
stackInUse: number;
systemTotal: number;
systemAvailable: number;
systemUsed: number;
systemUsedPercent: number;
}
/** Disk I/O metrics */
export interface DiskIOMetrics {
readBytes: number;
writeBytes: number;
readCount: number;
writeCount: number;
}
/** Storage metrics */
export interface StorageMetrics {
dbPath: string;
dbSizeBytes: number;
volumeTotal: number;
volumeFree: number;
volumeUsed: number;
}
/** Network metrics */
export interface NetworkMetrics {
bytesSent: number;
bytesRecv: number;
packetsSent: number;
packetsRecv: number;
}
/** System-level metrics */
export interface SystemMetrics {
cpu?: CpuMetrics;
memory?: MemoryMetrics;
diskIO?: DiskIOMetrics;
storage?: StorageMetrics;
network?: NetworkMetrics;
}
/** Result of a compact operation */
export interface CompactResult {
success: boolean;
message: string;
}
/** Result of a wait-for-compute-topology operation */
export interface ComputeTopologyResult {
ready: boolean;
message: string;
}