UNPKG

axiodb

Version:

The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor

64 lines (63 loc) 1.5 kB
import { Socket } from 'net'; import { EventEmitter } from 'events'; import { MessageBuffer } from '../config/protocol'; import { TCPResponse } from '../types/protocol.types'; /** * Connection metadata */ interface ConnectionInfo { socket: Socket; buffer: MessageBuffer; connectedAt: number; lastActivity: number; requestCount: number; } /** * Connection Manager - Manages all active TCP connections */ export declare class ConnectionManager extends EventEmitter { private connections; private connectionCounter; constructor(); /** * Add new connection */ addConnection(socket: Socket): string | null; /** * Remove connection */ removeConnection(connectionId: string): void; /** * Send response to client */ sendResponse(connectionId: string, response: TCPResponse): boolean; /** * Get connection info */ getConnection(connectionId: string): ConnectionInfo | undefined; /** * Get total active connections */ get activeConnections(): number; /** * Get all connection IDs */ getAllConnectionIds(): string[]; /** * Close all connections gracefully */ closeAll(): void; /** * Setup socket event handlers */ private setupSocketHandlers; /** * Generate unique connection ID */ private generateConnectionId; /** * Get connection statistics */ getStats(): Record<string, any>; } export {};