@pulzar/core
Version:
Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support
125 lines • 3.34 kB
TypeScript
import { EventAdapter, EventEnvelope, EventHandler, SubscribeOptions, SubscriptionHandle, AdapterStats, AdapterCapabilities, PublishResult, HealthStatus } from "../types";
export declare class MemoryEventAdapter implements EventAdapter {
readonly name = "memory";
readonly version = "1.0.0";
readonly capabilities: AdapterCapabilities;
private subscribers;
private stats;
private connected;
private throughputWindow;
private latencyWindow;
private errors;
private operations;
private activeTasks;
private maxConcurrency;
/**
* Connect to the memory adapter (no-op)
*/
connect(): Promise<void>;
/**
* Disconnect from the memory adapter
*/
disconnect(): Promise<void>;
/**
* Check if adapter is connected
*/
isConnected(): boolean;
/**
* Publish an event to all matching subscribers
*/
publish(subject: string, event: EventEnvelope): Promise<PublishResult>;
/**
* Subscribe to events with pattern matching
*/
subscribe(subject: string, handler: EventHandler, options?: SubscribeOptions): Promise<SubscriptionHandle>;
/**
* Unsubscribe from events
*/
unsubscribe(handle: SubscriptionHandle): Promise<void>;
/**
* Acknowledge event delivery (no-op for memory adapter)
*/
ack(event: EventEnvelope): Promise<void>;
/**
* Negative acknowledge - requeue event (no-op for memory adapter)
*/
nack(event: EventEnvelope, requeue?: boolean): Promise<void>;
/**
* Flush pending operations (no-op for memory adapter)
*/
flush(): Promise<void>;
/**
* Get adapter statistics
*/
getStats(): Promise<AdapterStats>;
/**
* Health check for memory adapter
*/
healthCheck(): Promise<HealthStatus>;
/**
* Find subscribers matching a subject (with wildcard support)
*/
private findMatchingSubscribers;
/**
* Check if subject matches pattern (supports * and > wildcards)
*/
private matchesPattern;
/**
* Match subject parts with pattern parts
*/
private matchesParts;
/**
* Wrap handler with concurrency control and error handling
*/
private wrapHandler;
/**
* Deliver event to subscriber
*/
private deliverEvent;
/**
* Wait for concurrency slot
*/
private waitForConcurrencySlot;
/**
* Update throughput metrics
*/
private updateThroughput;
/**
* Update latency metrics
*/
private updateLatency;
/**
* Get memory usage estimate
*/
private getMemoryUsage;
/**
* Get total number of subscribers
*/
private getTotalSubscribers;
/**
* Generate unique subscription ID
*/
private generateSubscriptionId;
/**
* Reset statistics
*/
private resetStats;
/**
* Get all active subjects
*/
getSubjects(): string[];
/**
* Get subscriber count for a specific subject
*/
getSubscriberCount(subject: string): number;
/**
* Clear all subscribers for a subject
*/
clearSubject(subject: string): void;
/**
* Set max concurrency
*/
setMaxConcurrency(maxConcurrency: number): void;
}
export default MemoryEventAdapter;
//# sourceMappingURL=memory.d.ts.map