UNPKG

harperdb

Version:

HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.

42 lines (41 loc) 1.72 kB
import { Socket } from 'net'; import type { Value } from '../resources/analytics'; import type { Resources } from '../resources/Resources'; /** * This is the central interface by which we define entry points for different server protocol plugins to listen for * incoming connections and requests. */ interface Server { socket?(listener: (socket: Socket) => void, options: ServerOptions): void; http?(listener: (request: Request, nextLayer: (request: Request) => Response) => void, options?: ServerOptions): void; request?(listener: (request: Request, nextLayer: (request: Request) => Response) => void, options?: ServerOptions): void; ws?(listener: (ws: WebSocket, request: Request, requestCompletion: Promise<any>) => any, options?: WebSocketOptions): void; contentTypes: Map<string, ContentTypeHandler>; getUser(username: string, password: string | null, request: Request): any; authenticateUser(username: string, password: string, request: Request): any; operation(operation: any, context: any, authorize?: boolean): Promise<any>; recordAnalytics(value: Value, metric: string, path?: string, method?: string, type?: string): void; nodes: Node[]; shards: Map<number, string[]>; hostname: string; resources: Resources; } interface Node { name: string; shard: number; } interface ServerOptions { port?: number; securePort?: number; } interface WebSocketOptions extends ServerOptions { subProtocol: string; } export interface ContentTypeHandler { serialize(data: any): Buffer | string; serializeStream(data: any): Buffer | string; deserialize(data: any): Buffer | string; q: number; } export declare const server: Server; export {};