Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

rename ffi func

appflowy76691e3e8c75
diff --git a/backend/graph.png b/backend/graph.png
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart
index eca2545988..b402bce694 100644
--- a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart
+++ b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart
@@ -101,7 +101,7 @@ Completer<Uint8List> _sendToRust(FFIRequest request) {
final completer = Completer<Uint8List>();
final port = singleCompletePort(completer);
- ffi.async_command(port.nativePort, input, bytes.length);
+ ffi.async_event(port.nativePort, input, bytes.length);
calloc.free(input);
return completer;
diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/ffi.dart b/frontend/app_flowy/packages/flowy_sdk/lib/ffi.dart
index 06fc5c60b2..71ea1b7286 100644
--- a/frontend/app_flowy/packages/flowy_sdk/lib/ffi.dart
+++ b/frontend/app_flowy/packages/flowy_sdk/lib/ffi.dart
@@ -20,8 +20,8 @@ DynamicLibrary _open() {
throw UnsupportedError('This platform is not supported.');
}
-/// C function `async_command`.
-void async_command(
+/// C function `async_event`.
+void async_event(
int port,
Pointer<Uint8> input,
int len,
@@ -29,7 +29,7 @@ void async_command(
_invoke_async(port, input, len);
}
-final _invoke_async_Dart _invoke_async = _dl.lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_command');
+final _invoke_async_Dart _invoke_async = _dl.lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_event');
typedef _invoke_async_C = Void Function(
Int64 port,
Pointer<Uint8> input,
@@ -41,15 +41,15 @@ typedef _invoke_async_Dart = void Function(
int len,
);
-/// C function `command_sync`.
-Pointer<Uint8> sync_command(
+/// C function `sync_event`.
+Pointer<Uint8> sync_event(
Pointer<Uint8> input,
int len,
) {
return _invoke_sync(input, len);
}
-final _invoke_sync_Dart _invoke_sync = _dl.lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_command');
+final _invoke_sync_Dart _invoke_sync = _dl.lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_event');
typedef _invoke_sync_C = Pointer<Uint8> Function(
Pointer<Uint8> input,
Uint64 len,
diff --git a/frontend/app_flowy/packages/flowy_sdk/macos/Classes/binding.h b/frontend/app_flowy/packages/flowy_sdk/macos/Classes/binding.h
index 036d56aa2a..a45d19dcef 100644
--- a/frontend/app_flowy/packages/flowy_sdk/macos/Classes/binding.h
+++ b/frontend/app_flowy/packages/flowy_sdk/macos/Classes/binding.h
@@ -3,12 +3,11 @@
#include <stdint.h>
#include <stdlib.h>
-
int64_t init_sdk(char *path);
-void async_command(int64_t port, const uint8_t *input, uintptr_t len);
+void async_event(int64_t port, const uint8_t *input, uintptr_t len);
-const uint8_t *sync_command(const uint8_t *input, uintptr_t len);
+const uint8_t *sync_event(const uint8_t *input, uintptr_t len);
int32_t set_stream_port(int64_t port);
diff --git a/frontend/rust-lib/dart-ffi/binding.h b/frontend/rust-lib/dart-ffi/binding.h
index 036d56aa2a..a45d19dcef 100644
--- a/frontend/rust-lib/dart-ffi/binding.h
+++ b/frontend/rust-lib/dart-ffi/binding.h
@@ -3,12 +3,11 @@
#include <stdint.h>
#include <stdlib.h>
-
int64_t init_sdk(char *path);
-void async_command(int64_t port, const uint8_t *input, uintptr_t len);
+void async_event(int64_t port, const uint8_t *input, uintptr_t len);
-const uint8_t *sync_command(const uint8_t *input, uintptr_t len);
+const uint8_t *sync_event(const uint8_t *input, uintptr_t len);
int32_t set_stream_port(int64_t port);
diff --git a/frontend/rust-lib/dart-ffi/src/lib.rs b/frontend/rust-lib/dart-ffi/src/lib.rs
index b2c5e4a914..4cf254c8a1 100644
--- a/frontend/rust-lib/dart-ffi/src/lib.rs
+++ b/frontend/rust-lib/dart-ffi/src/lib.rs
@@ -33,7 +33,7 @@ pub extern "C" fn init_sdk(path: *mut c_char) -> i64 {
}
#[no_mangle]
-pub extern "C" fn async_command(port: i64, input: *const u8, len: usize) {
+pub extern "C" fn async_event(port: i64, input: *const u8, len: usize) {
let request: ModuleRequest = FFIRequest::from_u8_pointer(input, len).into();
log::trace!(
"[FFI]: {} Async Event: {:?} with {} port",
@@ -49,7 +49,7 @@ pub extern "C" fn async_command(port: i64, input: *const u8, len: usize) {
}
#[no_mangle]
-pub extern "C" fn sync_command(input: *const u8, len: usize) -> *const u8 {
+pub extern "C" fn sync_event(input: *const u8, len: usize) -> *const u8 {
let request: ModuleRequest = FFIRequest::from_u8_pointer(input, len).into();
log::trace!("[FFI]: {} Sync Event: {:?}", &request.id, &request.event,);
let _response = EventDispatch::sync_send(dispatch(), request);