// SPDX-License-Identifier: AGPL-3.0-or-later export interface IKVPipeline { get(key: string): this; set(key: string, value: string): this; setex(key: string, ttlSeconds: number, value: string): this; del(key: string): this; expire(key: string, ttlSeconds: number): this; sadd(key: string, ...members: Array): this; srem(key: string, ...members: Array): this; zadd(key: string, score: number, value: string): this; zrem(key: string, ...members: Array): this; hgetall(key: string): this; mset(...args: Array): this; exec(): Promise>; } export interface IKVSubscription { connect(): Promise; on(event: 'message', callback: (channel: string, message: string) => void): void; on(event: 'error', callback: (error: Error) => void): void; off(event: 'message', callback: (channel: string, message: string) => void): void; off(event: 'error', callback: (error: Error) => void): void; subscribe(...channels: Array): Promise; unsubscribe(...channels: Array): Promise; quit(): Promise; disconnect(): Promise; removeAllListeners(event?: 'message' | 'error'): void; } export interface KVRateLimitResult { allowed: boolean; limit: number; remaining: number; resetAfterMs: number; resetAtMs: number; retryAfterMs: number; } export interface IKVProvider { get(key: string): Promise; set(key: string, value: string, ...args: Array): Promise; setex(key: string, ttlSeconds: number, value: string): Promise; setnx(key: string, value: string, ttlSeconds?: number): Promise; mget(...keys: Array): Promise>; mset(...args: Array): Promise; del(...keys: Array): Promise; exists(key: string): Promise; expire(key: string, ttlSeconds: number): Promise; ttl(key: string): Promise; incr(key: string): Promise; getex(key: string, ttlSeconds: number): Promise; getdel(key: string): Promise; sadd(key: string, ...members: Array): Promise; srem(key: string, ...members: Array): Promise; smembers(key: string): Promise>; sismember(key: string, member: string): Promise; scard(key: string): Promise; spop(key: string, count?: number): Promise>; zadd(key: string, ...scoreMembers: Array): Promise; zrem(key: string, ...members: Array): Promise; zcard(key: string): Promise; zrangebyscore( key: string, min: string | number, max: string | number, ...args: Array ): Promise>; rpush(key: string, ...values: Array): Promise; lpop(key: string, count?: number): Promise>; llen(key: string): Promise; hset(key: string, field: string, value: string): Promise; hdel(key: string, ...fields: Array): Promise; hget(key: string, field: string): Promise; hgetall(key: string): Promise>; publish(channel: string, message: string): Promise; duplicate(): IKVSubscription; acquireLock(key: string, token: string, ttlSeconds: number): Promise; releaseLock(key: string, token: string): Promise; extendLock(key: string, token: string, ttlSeconds: number): Promise; renewSnowflakeNode(key: string, instanceId: string, ttlSeconds: number): Promise; checkLeakyBucketLimit(key: string, limit: number, windowMs: number, cost: number): Promise; tryConsumeTokens( key: string, requested: number, maxTokens: number, refillRate: number, refillIntervalMs: number, ): Promise; scheduleBulkDeletion(queueKey: string, secondaryKey: string, score: number, value: string): Promise; removeBulkDeletion(queueKey: string, secondaryKey: string): Promise; scan(pattern: string, count: number): Promise>; dequeuePurgeBatch( queueKey: string, bucketKey: string, maxItems: number, maxTokens: number, refillRate: number, refillIntervalMs: number, ): Promise<{ urls: Array; tokensConsumed: number; }>; pipeline(): IKVPipeline; multi(): IKVPipeline; health(): Promise; }