/** * Memory Storage Adapter * In-memory storage adapter for environments where persistent storage is not available or needed */ import { GraphVerb, HNSWNoun, HNSWVerb, StatisticsData } from '../../coreTypes.js'; import { BaseStorage } from '../baseStorage.js'; import { PaginatedResult } from '../../types/paginationTypes.js'; /** * In-memory storage adapter * Uses Maps to store data in memory */ export declare class MemoryStorage extends BaseStorage { private nouns; private verbs; private metadata; private nounMetadata; private verbMetadata; private statistics; constructor(); /** * Initialize the storage adapter * Nothing to initialize for in-memory storage */ init(): Promise; /** * Save a noun to storage */ protected saveNoun_internal(noun: HNSWNoun): Promise; /** * Get a noun from storage */ protected getNoun_internal(id: string): Promise; /** * Get nouns with pagination and filtering * @param options Pagination and filtering options * @returns Promise that resolves to a paginated result of nouns */ getNouns(options?: { pagination?: { offset?: number; limit?: number; cursor?: string; }; filter?: { nounType?: string | string[]; service?: string | string[]; metadata?: Record; }; }): Promise>; /** * Get nouns with pagination - simplified interface for compatibility */ getNounsWithPagination(options?: { limit?: number; cursor?: string; filter?: any; }): Promise<{ items: HNSWNoun[]; totalCount: number; hasMore: boolean; nextCursor?: string; }>; /** * Get nouns by noun type * @param nounType The noun type to filter by * @returns Promise that resolves to an array of nouns of the specified noun type * @deprecated Use getNouns() with filter.nounType instead */ protected getNounsByNounType_internal(nounType: string): Promise; /** * Delete a noun from storage */ protected deleteNoun_internal(id: string): Promise; /** * Save a verb to storage */ protected saveVerb_internal(verb: HNSWVerb): Promise; /** * Get a verb from storage */ protected getVerb_internal(id: string): Promise; /** * Get verbs with pagination and filtering * @param options Pagination and filtering options * @returns Promise that resolves to a paginated result of verbs */ getVerbs(options?: { pagination?: { offset?: number; limit?: number; cursor?: string; }; filter?: { verbType?: string | string[]; sourceId?: string | string[]; targetId?: string | string[]; service?: string | string[]; metadata?: Record; }; }): Promise>; /** * Get verbs by source * @deprecated Use getVerbs() with filter.sourceId instead */ protected getVerbsBySource_internal(sourceId: string): Promise; /** * Get verbs by target * @deprecated Use getVerbs() with filter.targetId instead */ protected getVerbsByTarget_internal(targetId: string): Promise; /** * Get verbs by type * @deprecated Use getVerbs() with filter.verbType instead */ protected getVerbsByType_internal(type: string): Promise; /** * Delete a verb from storage */ protected deleteVerb_internal(id: string): Promise; /** * Save metadata to storage */ saveMetadata(id: string, metadata: any): Promise; /** * Get metadata from storage */ getMetadata(id: string): Promise; /** * Get multiple metadata objects in batches (CRITICAL: Prevents socket exhaustion) * Memory storage implementation is simple since all data is already in memory */ getMetadataBatch(ids: string[]): Promise>; /** * Save noun metadata to storage */ saveNounMetadata(id: string, metadata: any): Promise; /** * Get noun metadata from storage */ getNounMetadata(id: string): Promise; /** * Save verb metadata to storage */ saveVerbMetadata(id: string, metadata: any): Promise; /** * Get verb metadata from storage */ getVerbMetadata(id: string): Promise; /** * Clear all data from storage */ clear(): Promise; /** * Get information about storage usage and capacity */ getStorageStatus(): Promise<{ type: string; used: number; quota: number | null; details?: Record; }>; /** * Save statistics data to storage * @param statistics The statistics data to save */ protected saveStatisticsData(statistics: StatisticsData): Promise; /** * Get statistics data from storage * @returns Promise that resolves to the statistics data or null if not found */ protected getStatisticsData(): Promise; }