/* * Copyright (C) 2026 Fluxer Contributors * * This file is part of Fluxer. * * Fluxer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Fluxer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Fluxer. If not, see . */ 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; 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; subscribe(...channels: Array): Promise; unsubscribe(...channels: Array): Promise; quit(): Promise; disconnect(): Promise; removeAllListeners(event?: 'message' | 'error'): void; } 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; releaseLock(key: string, token: string): Promise; renewSnowflakeNode(key: string, instanceId: string, ttlSeconds: 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>; pipeline(): IKVPipeline; multi(): IKVPipeline; health(): Promise; }