WASM work

This commit is contained in:
John Smith
2022-03-15 09:33:34 -04:00
parent 031c998cfc
commit ca85b555aa
25 changed files with 672 additions and 395 deletions

View File

@@ -705,7 +705,7 @@ class VeilidConfigCapabilities {
class VeilidConfig {
String programName;
String namespace;
VeilidConfigLogLevel apiLogLevel;
VeilidConfigLogLevel logLevel;
VeilidConfigCapabilities capabilities;
VeilidConfigProtectedStore protectedStore;
VeilidConfigTableStore tableStore;
@@ -715,7 +715,7 @@ class VeilidConfig {
VeilidConfig({
required this.programName,
required this.namespace,
required this.apiLogLevel,
required this.logLevel,
required this.capabilities,
required this.protectedStore,
required this.tableStore,
@@ -727,7 +727,7 @@ class VeilidConfig {
return {
'program_name': programName,
'namespace': namespace,
'api_log_level': apiLogLevel.json,
'log_level': logLevel.json,
'capabilities': capabilities.json,
'protected_store': protectedStore.json,
'table_store': tableStore.json,
@@ -739,7 +739,7 @@ class VeilidConfig {
VeilidConfig.fromJson(Map<String, dynamic> json)
: programName = json['program_name'],
namespace = json['namespace'],
apiLogLevel = json['api_log_level'],
logLevel = json['log_level'],
capabilities = VeilidConfigCapabilities.fromJson(json['capabilities']),
protectedStore =
VeilidConfigProtectedStore.fromJson(json['protected_store']),
@@ -993,7 +993,7 @@ abstract class Veilid {
Stream<VeilidUpdate> startupVeilidCore(VeilidConfig config);
Future<VeilidState> getVeilidState();
Future<void> changeApiLogLevel(VeilidConfigLogLevel logLevel);
Future<void> changeLogLevel(VeilidConfigLogLevel logLevel);
Future<void> shutdownVeilidCore();
Future<String> debug(String command);
String veilidVersionString();

View File

@@ -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_api_log_level(port: i64, log_level: FfiStr)
typedef _ChangeApiLogLevelC = Void Function(Int64, Pointer<Utf8>);
typedef _ChangeApiLogLevelDart = void Function(int, Pointer<Utf8>);
// fn change_log_level(port: i64, log_level: FfiStr)
typedef _ChangeLogLevelC = Void Function(Int64, Pointer<Utf8>);
typedef _ChangeLogLevelDart = 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 _ChangeApiLogLevelDart _changeApiLogLevel;
final _ChangeLogLevelDart _changeLogLevel;
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'),
_changeApiLogLevel =
dylib.lookupFunction<_ChangeApiLogLevelC, _ChangeApiLogLevelDart>(
'change_api_log_level'),
_changeLogLevel =
dylib.lookupFunction<_ChangeLogLevelC, _ChangeLogLevelDart>(
'change_log_level'),
_shutdownVeilidCore =
dylib.lookupFunction<_ShutdownVeilidCoreC, _ShutdownVeilidCoreDart>(
'shutdown_veilid_core'),
@@ -299,11 +299,11 @@ class VeilidFFI implements Veilid {
}
@override
Future<void> changeApiLogLevel(VeilidConfigLogLevel logLevel) async {
Future<void> changeLogLevel(VeilidConfigLogLevel logLevel) async {
var nativeLogLevel = logLevel.json.toNativeUtf8();
final recvPort = ReceivePort("change_api_log_level");
final recvPort = ReceivePort("change_log_level");
final sendPort = recvPort.sendPort;
_changeApiLogLevel(sendPort.nativePort, nativeLogLevel);
_changeLogLevel(sendPort.nativePort, nativeLogLevel);
malloc.free(nativeLogLevel);
return processFutureVoid(recvPort.first);
}

View File

@@ -20,7 +20,7 @@ class VeilidJS implements Veilid {
}
@override
Future<void> changeApiLogLevel(VeilidConfigLogLevel logLevel) {
Future<void> changeLogLevel(VeilidConfigLogLevel logLevel) {
throw UnimplementedError();
}