ferrum-db-client
Advanced tools
Comparing version 0.3.9 to 0.3.10
@@ -18,3 +18,3 @@ import { FerrumDBRemote } from './db_remote'; | ||
readonly onResponseReceived: EventEmitter<DatabaseResponseMetrics>; | ||
readonly onTimeout: EventEmitter<void>; | ||
readonly onTimeout: EventEmitter<string>; | ||
private constructor(); | ||
@@ -26,2 +26,4 @@ setRequestTimeout(timeout: number): void; | ||
private disconnect; | ||
static reconnectAll(): void; | ||
reconnect(): void; | ||
createDatabaseIfNotExists(dbName: string): Promise<FerrumDBRemote>; | ||
@@ -28,0 +30,0 @@ createDatabase(dbName: string): Promise<FerrumDBRemote>; |
@@ -69,2 +69,13 @@ "use strict"; | ||
} | ||
static reconnectAll() { | ||
for (const key of Object.keys(FerrumServerClient.instanceMap)) { | ||
FerrumServerClient.instanceMap[key].reconnect(); | ||
} | ||
} | ||
reconnect() { | ||
this.client = new database_server_grpc_pb_1.DatabaseServerClient(`${this.ip}:${this.port}`, grpc_js_1.ChannelCredentials.createSsl(), { | ||
'grpc.max_send_message_length': -1, | ||
'grpc.max_receive_message_length': -1, | ||
}); | ||
} | ||
async createDatabaseIfNotExists(dbName) { | ||
@@ -71,0 +82,0 @@ const msg = new database_server_pb_1.CreateDatabaseRequest(); |
@@ -21,3 +21,3 @@ import { ServiceError } from '@grpc/grpc-js'; | ||
startNotifier: EventEmitter<void>; | ||
timeoutNotifier: EventEmitter<void>; | ||
timeoutNotifier: EventEmitter<string>; | ||
responseNotifier: EventEmitter<DatabaseResponseMetrics>; | ||
@@ -24,0 +24,0 @@ timeout: number; |
@@ -58,3 +58,3 @@ "use strict"; | ||
timeoutHandle = setTimeout(() => { | ||
observerConfig.timeoutNotifier.emit(); | ||
observerConfig.timeoutNotifier.emit(printMessage(msg)); | ||
}, observerConfig.timeout); | ||
@@ -61,0 +61,0 @@ } |
{ | ||
"name": "ferrum-db-client", | ||
"version": "0.3.9", | ||
"version": "0.3.10", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
@@ -30,3 +30,3 @@ import { ChannelCredentials } from '@grpc/grpc-js'; | ||
public readonly onResponseReceived: EventEmitter<DatabaseResponseMetrics> = new EventEmitter(); | ||
public readonly onTimeout: EventEmitter<void> = new EventEmitter(); | ||
public readonly onTimeout: EventEmitter<string> = new EventEmitter(); | ||
@@ -78,6 +78,19 @@ private constructor(ip: string, port: number) { | ||
private disconnect() { | ||
private disconnect(): void { | ||
this.client.close(); | ||
} | ||
public static reconnectAll(): void { | ||
for (const key of Object.keys(FerrumServerClient.instanceMap)) { | ||
FerrumServerClient.instanceMap[key].reconnect(); | ||
} | ||
} | ||
public reconnect(): void { | ||
this.client = new DatabaseServerClient(`${this.ip}:${this.port}`, ChannelCredentials.createSsl(), { | ||
'grpc.max_send_message_length': -1, | ||
'grpc.max_receive_message_length': -1, | ||
}); | ||
} | ||
public async createDatabaseIfNotExists(dbName: string): Promise<FerrumDBRemote> { | ||
@@ -84,0 +97,0 @@ const msg = new CreateDatabaseRequest(); |
@@ -57,3 +57,3 @@ import { ServiceError } from '@grpc/grpc-js'; | ||
startNotifier: EventEmitter<void>; | ||
timeoutNotifier: EventEmitter<void>; | ||
timeoutNotifier: EventEmitter<string>; | ||
responseNotifier: EventEmitter<DatabaseResponseMetrics>; | ||
@@ -70,3 +70,3 @@ timeout: number; | ||
timeoutHandle = setTimeout(() => { | ||
observerConfig.timeoutNotifier.emit(); | ||
observerConfig.timeoutNotifier.emit(printMessage(msg)); | ||
}, observerConfig.timeout); | ||
@@ -73,0 +73,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1221244
28186
7