refactor checkpoint
This commit is contained in:
@@ -745,7 +745,7 @@ class VeilidConfigCapabilities {
|
||||
class VeilidConfig {
|
||||
String programName;
|
||||
String namespace;
|
||||
VeilidConfigLogLevel logLevel;
|
||||
VeilidConfigLogLevel apiLogLevel;
|
||||
VeilidConfigCapabilities capabilities;
|
||||
VeilidConfigProtectedStore protectedStore;
|
||||
VeilidConfigTableStore tableStore;
|
||||
@@ -755,7 +755,7 @@ class VeilidConfig {
|
||||
VeilidConfig({
|
||||
required this.programName,
|
||||
required this.namespace,
|
||||
required this.logLevel,
|
||||
required this.apiLogLevel,
|
||||
required this.capabilities,
|
||||
required this.protectedStore,
|
||||
required this.tableStore,
|
||||
@@ -767,7 +767,7 @@ class VeilidConfig {
|
||||
return {
|
||||
'program_name': programName,
|
||||
'namespace': namespace,
|
||||
'log_level': logLevel.json,
|
||||
'api_log_level': apiLogLevel.json,
|
||||
'capabilities': capabilities.json,
|
||||
'protected_store': protectedStore.json,
|
||||
'table_store': tableStore.json,
|
||||
@@ -779,7 +779,7 @@ class VeilidConfig {
|
||||
VeilidConfig.fromJson(Map<String, dynamic> json)
|
||||
: programName = json['program_name'],
|
||||
namespace = json['namespace'],
|
||||
logLevel = json['log_level'],
|
||||
apiLogLevel = json['api_log_level'],
|
||||
capabilities = VeilidConfigCapabilities.fromJson(json['capabilities']),
|
||||
protectedStore =
|
||||
VeilidConfigProtectedStore.fromJson(json['protected_store']),
|
||||
@@ -797,7 +797,7 @@ abstract class VeilidUpdate {
|
||||
case "Log":
|
||||
{
|
||||
return VeilidUpdateLog(
|
||||
veilidLogLevelFromJson(json["log_level"]), json["message"]);
|
||||
veilidLogLevelFromJson(json["api_log_level"]), json["message"]);
|
||||
}
|
||||
case "Attachment":
|
||||
{
|
||||
@@ -1072,7 +1072,7 @@ abstract class Veilid {
|
||||
|
||||
Stream<VeilidUpdate> startupVeilidCore(VeilidConfig config);
|
||||
Future<VeilidState> getVeilidState();
|
||||
Future<void> changeLogLevel(VeilidConfigLogLevel logLevel);
|
||||
Future<void> changeApiLogLevel(VeilidConfigLogLevel logLevel);
|
||||
Future<void> shutdownVeilidCore();
|
||||
Future<String> debug(String command);
|
||||
String veilidVersionString();
|
||||
|
@@ -35,9 +35,9 @@ typedef _StartupVeilidCoreDart = void Function(int, Pointer<Utf8>);
|
||||
// fn get_veilid_state(port: i64)
|
||||
typedef _GetVeilidStateC = Void Function(Int64);
|
||||
typedef _GetVeilidStateDart = void Function(int);
|
||||
// fn change_log_level(port: i64, log_level: FfiStr)
|
||||
typedef _ChangeLogLevelC = Void Function(Int64, Pointer<Utf8>);
|
||||
typedef _ChangeLogLevelDart = void Function(int, Pointer<Utf8>);
|
||||
// fn change_api_log_level(port: i64, log_level: FfiStr)
|
||||
typedef _ChangeApiLogLevelC = Void Function(Int64, Pointer<Utf8>);
|
||||
typedef _ChangeApiLogLevelDart = void Function(int, Pointer<Utf8>);
|
||||
// fn debug(port: i64, log_level: FfiStr)
|
||||
typedef _DebugC = Void Function(Int64, Pointer<Utf8>);
|
||||
typedef _DebugDart = void Function(int, Pointer<Utf8>);
|
||||
@@ -243,7 +243,7 @@ class VeilidFFI implements Veilid {
|
||||
final _FreeStringDart _freeString;
|
||||
final _StartupVeilidCoreDart _startupVeilidCore;
|
||||
final _GetVeilidStateDart _getVeilidState;
|
||||
final _ChangeLogLevelDart _changeLogLevel;
|
||||
final _ChangeApiLogLevelDart _changeApiLogLevel;
|
||||
final _ShutdownVeilidCoreDart _shutdownVeilidCore;
|
||||
final _DebugDart _debug;
|
||||
final _VeilidVersionStringDart _veilidVersionString;
|
||||
@@ -259,9 +259,9 @@ class VeilidFFI implements Veilid {
|
||||
_getVeilidState =
|
||||
dylib.lookupFunction<_GetVeilidStateC, _GetVeilidStateDart>(
|
||||
'get_veilid_state'),
|
||||
_changeLogLevel =
|
||||
dylib.lookupFunction<_ChangeLogLevelC, _ChangeLogLevelDart>(
|
||||
'change_log_level'),
|
||||
_changeApiLogLevel =
|
||||
dylib.lookupFunction<_ChangeApiLogLevelC, _ChangeApiLogLevelDart>(
|
||||
'change_api_log_level'),
|
||||
_shutdownVeilidCore =
|
||||
dylib.lookupFunction<_ShutdownVeilidCoreC, _ShutdownVeilidCoreDart>(
|
||||
'shutdown_veilid_core'),
|
||||
@@ -299,11 +299,11 @@ class VeilidFFI implements Veilid {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> changeLogLevel(VeilidConfigLogLevel logLevel) async {
|
||||
Future<void> changeApiLogLevel(VeilidConfigLogLevel logLevel) async {
|
||||
var nativeLogLevel = logLevel.json.toNativeUtf8();
|
||||
final recvPort = ReceivePort("change_log_level");
|
||||
final recvPort = ReceivePort("change_api_log_level");
|
||||
final sendPort = recvPort.sendPort;
|
||||
_changeLogLevel(sendPort.nativePort, nativeLogLevel);
|
||||
_changeApiLogLevel(sendPort.nativePort, nativeLogLevel);
|
||||
malloc.free(nativeLogLevel);
|
||||
return processFutureVoid(recvPort.first);
|
||||
}
|
||||
|
@@ -46,8 +46,8 @@ class VeilidJS implements Veilid {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> changeLogLevel(VeilidConfigLogLevel logLevel) {
|
||||
return _wrapApiPromise(js_util.callMethod(wasm, "change_log_level",
|
||||
Future<void> changeApiLogLevel(VeilidConfigLogLevel logLevel) {
|
||||
return _wrapApiPromise(js_util.callMethod(wasm, "change_api_log_level",
|
||||
[jsonEncode(logLevel.json, toEncodable: veilidApiToEncodable)]));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user