@@ -26,17 +26,6 @@ import { randomUUID } from 'crypto';
2626 * Minimal async key-value store used by plugins.
2727 */
2828export interface PluginKVStore {
29- /**
30- * Establish the connection. Call once before using the store.
31- * @returns Promise that resolves when the connection is established.
32- */
33- connect ( ) : Promise < void > ;
34- /**
35- * Close the connection gracefully. Safe to call multiple times.
36- * @returns Promise that resolves when the connection is closed.
37- */
38- disconnect ( ) : Promise < void > ;
39-
4029 /**
4130 * Get and JSON-parse a value by key.
4231 * @typeParam T - Expected value type after JSON parse.
@@ -68,12 +57,12 @@ export interface PluginKVStore {
6857 exists ( key : string ) : Promise < boolean > ;
6958
7059 /**
71- * Scan this namespace for keys matching `pattern`.
60+ * List keys in this namespace matching `pattern`.
7261 * @param pattern - Glob-like match pattern (default '*').
7362 * @param batch - SCAN COUNT per iteration (default 500).
7463 * @returns Array of bare keys (without the namespace prefix).
7564 */
76- scan ( pattern ?: string , batch ?: number ) : Promise < string [ ] > ;
65+ listKeys ( pattern ?: string , batch ?: number ) : Promise < string [ ] > ;
7766 /**
7867 * Remove all keys in this namespace.
7968 * @returns The number of keys deleted.
@@ -133,27 +122,6 @@ export class DefaultPluginKVStore implements PluginKVStore {
133122 this . ns = `plugin_kv:{${ pid } }` ;
134123 }
135124
136- /**
137- * Connect the underlying Redis client. Call before any operation.
138- * @returns Promise that resolves when the Redis connection is established.
139- */
140- async connect ( ) : Promise < void > {
141- await this . client . connect ( ) ;
142- }
143-
144- /**
145- * Close the Redis connection. Falls back to hard disconnect if graceful
146- * quit fails (e.g., when the connection is not fully established).
147- * @returns Promise that resolves when the connection is closed.
148- */
149- async disconnect ( ) : Promise < void > {
150- try {
151- await this . client . quit ( ) ;
152- } catch {
153- this . client . disconnect ( ) ;
154- }
155- }
156-
157125 /**
158126 * Build a namespaced Redis key for the given segment and user key.
159127 * Validates the user-provided key and throws on invalid input.
@@ -222,13 +190,13 @@ export class DefaultPluginKVStore implements PluginKVStore {
222190 }
223191
224192 /**
225- * Iterate over keys in this store, matching `pattern` (glob-like, default '*').
193+ * List keys in this store matching `pattern` (glob-like, default '*').
226194 * Returns bare keys (without namespace). Uses SCAN with COUNT=`batch`.
227195 * @param pattern - Glob-like match pattern (default '*').
228196 * @param batch - SCAN COUNT per iteration (default 500).
229197 * @returns Array of bare keys (without the namespace prefix).
230198 */
231- async scan ( pattern = '*' , batch = 500 ) : Promise < string [ ] > {
199+ async listKeys ( pattern = '*' , batch = 500 ) : Promise < string [ ] > {
232200 const out : string [ ] = [ ] ;
233201 let cursor = '0' ;
234202 const prefix = `${ this . ns } :data:` ;
0 commit comments