@iobroker/db-objects-file
Version:
The Library contains the Database classes for File based objects database client and server.
95 lines • 3.1 kB
TypeScript
/**
* This class inherits statesInMemoryFileDB class and adds redis communication layer
* to access the methods via redis protocol
*/
export class ObjectsInMemoryServer extends ObjectsInMemoryFileDB {
/**
* Constructor
*
* @param settings State and InMem-DB settings
*/
constructor(settings: any);
serverConnections: {};
namespaceObjects: string;
namespaceFile: string;
namespaceObj: string;
namespaceSet: string;
namespaceSetLen: number;
namespaceFileLen: number;
namespaceObjLen: number;
namespaceMeta: string;
namespaceMetaLen: number;
knownScripts: {};
normalizeFileRegex1: RegExp;
normalizeFileRegex2: RegExp;
/**
* Separate Namespace from ID and return both
*
* @param idWithNamespace ID or Array of IDs containing a redis namespace and the real ID
* @returns Object with namespace and the
* ID/Array of IDs without the namespace
*/
_normalizeId(idWithNamespace: any): {
id: string | any[] | null;
namespace: string;
name: string;
isMeta: boolean | undefined;
};
/**
* Publish a subscribed value to one of the redis connections in redis format
*
* @param client Instance of RedisHandler
* @param type Type of subscribed key
* @param id Subscribed ID
* @param obj Object to publish
* @returns Publish counter 0 or 1 depending on if send out or not
*/
publishToClients(client: any, type: any, id: any, obj: any): 1 | 0;
/**
* Generate ID for a File
*
* @param id ID of the File
* @param name Name of the file
* @param isMeta generate a META ID or a Data ID?
* @returns File-ID
*/
getFileId(id: any, name: any, isMeta: any): string;
/**
* Register all event listeners for Handler and implement the relevant logic
*
* @param handler RedisHandler instance
*/
_socketEvents(handler: any): void;
/**
* Return connected RedisHandlers/Connections
*
* @returns
*/
getClients(): {};
/**
* Get keys matching pattern and send it to given responseId, for "SCAN" and "KEYS" - Objects and files supported
*
* @param handler RedisHandler instance
* @param pattern - pattern without namespace prefix
* @param responseId - Id where response will be sent to
* @param isScan - if used by "SCAN" this flag should be true
*/
_handleScanOrKeys(handler: any, pattern: any, responseId: any, isScan?: boolean): undefined;
/**
* Initialize RedisHandler for a new network connection
*
* @param socket Network socket
*/
_initSocket(socket: any): void;
/**
* Initialize Redis Server
*
* @param settings Settings object
* @returns
*/
_initRedisServer(settings: any): Promise<any>;
server: net.Server | undefined;
}
import { ObjectsInMemoryFileDB } from './objectsInMemFileDB.js';
import net from 'node:net';
//# sourceMappingURL=objectsInMemServerRedis.d.ts.map