@x5e/gink
Version:
an eventually consistent database
40 lines (39 loc) • 1.43 kB
TypeScript
import { AuthFunction, CallBack, DirPath, NumberStr, FilePath } from "./typedefs";
/**
* A class that listens on a port, and then serves either static content over HTTP(S)
* or opens websocket connections and hands it off to the appropriate RoutingServerInstance.
*
* The user passes in a dataFilesRoot, which should be a writable directory on the local system.
* The RoutingServer will create a RoutingServerInstance for each file/requested resource.
*/
export declare class RoutingServer {
ready: Promise<void>;
readonly logger: CallBack;
readonly dataFilesRoot: DirPath | null;
readonly authFunc: AuthFunction;
private listener;
private identity;
private instances;
constructor(args: {
dataFilesRoot: DirPath;
port?: NumberStr;
sslKeyFilePath?: FilePath;
sslCertFilePath?: FilePath;
staticContentRoot?: DirPath;
identity?: string;
logger?: CallBack;
authFunc?: AuthFunction;
});
/**
*
* @param path absolute path to the args.data_file
* @returns a promise of an instance that will manage that file
*/
private getInstance;
/**
* Decides whether to accept the request, and if it does, hands it off
* to a database instance to manage that connection to the specified resource.
* @param request contains information passed from the websocket server
*/
private onRequest;
}