Skip to content

Commit ca92a0d

Browse files
committed
fix: refine codes
1 parent 61afd60 commit ca92a0d

File tree

11 files changed

+18
-46
lines changed

11 files changed

+18
-46
lines changed

core/src/ten_runtime/binding/go/interface/ten_runtime/msg.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ type Msg interface {
4646

4747
GetName() (string, error)
4848
SetDest(
49-
appUri string,
50-
graphId string,
51-
extensionGroup string,
49+
appURI string,
50+
graphID string,
5251
extension string,
5352
) error
5453

@@ -205,22 +204,19 @@ func (p *msg) GetName() (string, error) {
205204
}
206205

207206
func (p *msg) SetDest(
208-
appUri string,
209-
graphId string,
210-
extensionGroup string,
207+
appURI string,
208+
graphID string,
211209
extension string,
212210
) error {
213211
defer p.keepAlive()
214212

215213
err := withCGOLimiter(func() error {
216214
apiStatus := C.ten_go_msg_set_dest(
217215
p.cPtr,
218-
unsafe.Pointer(unsafe.StringData(appUri)),
219-
C.int(len(appUri)),
220-
unsafe.Pointer(unsafe.StringData(graphId)),
221-
C.int(len(graphId)),
222-
unsafe.Pointer(unsafe.StringData(extensionGroup)),
223-
C.int(len(extensionGroup)),
216+
unsafe.Pointer(unsafe.StringData(appURI)),
217+
C.int(len(appURI)),
218+
unsafe.Pointer(unsafe.StringData(graphID)),
219+
C.int(len(graphID)),
224220
unsafe.Pointer(unsafe.StringData(extension)),
225221
C.int(len(extension)),
226222
)

core/src/ten_runtime/binding/go/interface/ten_runtime/msg.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,5 @@ ten_go_error_t ten_go_msg_get_name(uintptr_t bridge_addr, const char **name);
307307

308308
ten_go_error_t ten_go_msg_set_dest(uintptr_t bridge_addr, const void *app_uri,
309309
int app_uri_len, const void *graph_id,
310-
int graph_id_len,
311-
const void *extension_group,
312-
int extension_group_len,
313-
const void *extension, int extension_len);
310+
int graph_id_len, const void *extension,
311+
int extension_len);

core/src/ten_runtime/binding/go/native/msg/msg.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,8 @@ ten_go_error_t ten_go_msg_get_name(uintptr_t bridge_addr, const char **name) {
816816

817817
ten_go_error_t ten_go_msg_set_dest(uintptr_t bridge_addr, const void *app_uri,
818818
int app_uri_len, const void *graph_id,
819-
int graph_id_len,
820-
const void *extension_group,
821-
int extension_group_len,
822-
const void *extension, int extension_len) {
819+
int graph_id_len, const void *extension,
820+
int extension_len) {
823821
ten_go_msg_t *self = ten_go_msg_reinterpret(bridge_addr);
824822
TEN_ASSERT(self && ten_go_msg_check_integrity(self), "Should not happen.");
825823

@@ -832,10 +830,6 @@ ten_go_error_t ten_go_msg_set_dest(uintptr_t bridge_addr, const void *app_uri,
832830
ten_string_t graph_id_str;
833831
ten_string_init_from_c_str_with_size(&graph_id_str, graph_id, graph_id_len);
834832

835-
ten_string_t extension_group_str;
836-
ten_string_init_from_c_str_with_size(&extension_group_str, extension_group,
837-
extension_group_len);
838-
839833
ten_string_t extension_str;
840834
ten_string_init_from_c_str_with_size(&extension_str, extension,
841835
extension_len);
@@ -856,7 +850,6 @@ ten_go_error_t ten_go_msg_set_dest(uintptr_t bridge_addr, const void *app_uri,
856850
ten_error_deinit(&err);
857851
ten_string_deinit(&app_uri_str);
858852
ten_string_deinit(&graph_id_str);
859-
ten_string_deinit(&extension_group_str);
860853
ten_string_deinit(&extension_str);
861854

862855
return cgo_error;

core/src/ten_runtime/binding/nodejs/interface/msg/msg.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ export class Msg {
1414
setDest(
1515
appUri: string | undefined = undefined,
1616
graphId: string | undefined = undefined,
17-
extensionGroup: string | undefined = undefined,
1817
extension: string | undefined = undefined,
1918
) {
2019
ten_addon.ten_nodejs_msg_set_dest(
2120
this,
2221
appUri,
2322
graphId,
24-
extensionGroup,
2523
extension,
2624
);
2725
}

core/src/ten_runtime/binding/nodejs/native/msg/msg.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ static napi_value ten_nodejs_msg_set_dest(napi_env env,
9898
ten_string_t graph_id;
9999
TEN_STRING_INIT(graph_id);
100100

101-
ten_string_t extension_group;
102-
TEN_STRING_INIT(extension_group);
103-
104101
ten_string_t extension;
105102
TEN_STRING_INIT(extension);
106103

@@ -115,12 +112,7 @@ static napi_value ten_nodejs_msg_set_dest(napi_env env,
115112
}
116113

117114
if (!is_js_undefined(env, args[3])) {
118-
bool rc = ten_nodejs_get_str_from_js(env, args[3], &extension_group);
119-
RETURN_UNDEFINED_IF_NAPI_FAIL(rc, "Failed to get extension group", NULL);
120-
}
121-
122-
if (!is_js_undefined(env, args[4])) {
123-
bool rc = ten_nodejs_get_str_from_js(env, args[4], &extension);
115+
bool rc = ten_nodejs_get_str_from_js(env, args[3], &extension);
124116
RETURN_UNDEFINED_IF_NAPI_FAIL(rc, "Failed to get extension", NULL);
125117
}
126118

@@ -140,7 +132,6 @@ static napi_value ten_nodejs_msg_set_dest(napi_env env,
140132

141133
ten_string_deinit(&app_uri);
142134
ten_string_deinit(&graph_id);
143-
ten_string_deinit(&extension_group);
144135
ten_string_deinit(&extension);
145136
ten_error_deinit(&err);
146137

core/src/ten_runtime/binding/python/interface/ten_runtime/libten_runtime_python.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class _Msg:
2828
self,
2929
app_uri: Optional[str],
3030
graph_id: Optional[str],
31-
extension_group: Optional[str],
3231
extension: Optional[str],
3332
) -> None: ...
3433
def set_property_from_json(

core/src/ten_runtime/binding/python/native/msg/msg.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,8 @@ PyObject *ten_py_msg_set_dest(PyObject *self, TEN_UNUSED PyObject *args) {
117117

118118
const char *app_uri = NULL;
119119
const char *graph_id = NULL;
120-
const char *extension_group_name = NULL;
121120
const char *extension_name = NULL;
122-
if (!PyArg_ParseTuple(args, "zzzz", &app_uri, &graph_id,
123-
&extension_group_name, &extension_name)) {
121+
if (!PyArg_ParseTuple(args, "zzz", &app_uri, &graph_id, &extension_name)) {
124122
return ten_py_raise_py_value_error_exception("Failed to parse arguments.");
125123
}
126124

tests/ten_runtime/integration/go/close_app_cmd_go/close_app_cmd_go_app/ten_packages/extension/default_extension_go/extension.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (ext *defaultExtension) OnCmd(
3636

3737
closeAppCmd, _ := ten.NewCmd("ten:close_app")
3838

39-
err := closeAppCmd.SetDest("localhost", "", "", "")
39+
err := closeAppCmd.SetDest("localhost", "", "")
4040
if err != nil {
4141
tenEnv.LogError("Failed to SetDest:" + err.Error())
4242
return

tests/ten_runtime/integration/go/prepare_to_stop_go/client/client.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ int main(TEN_UNUSED int argc, TEN_UNUSED char **argv) {
1414
auto *client = new ten::msgpack_tcp_client_t("msgpack://127.0.0.1:8007/");
1515

1616
auto start_cmd = ten::cmd_t::create("start");
17-
start_cmd->set_dest("msgpack://127.0.0.1:8007/", "default", "nodetest_group",
18-
"A");
17+
start_cmd->set_dest("msgpack://127.0.0.1:8007/", "default", "A");
1918
auto cmd_result = client->send_cmd_and_recv_result(std::move(start_cmd));
2019
TEN_ASSERT(TEN_STATUS_CODE_OK == cmd_result->get_status_code(),
2120
"Should not happen.");

tests/ten_runtime/integration/go/three_extension_cmd_go/client/client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(TEN_UNUSED int argc, TEN_UNUSED char **argv) {
7373

7474
TEN_LOGD("got graph result");
7575
auto A_cmd = ten::cmd_t::create("A");
76-
A_cmd->set_dest("msgpack://127.0.0.1:8007/", nullptr, "nodetest_group", "A");
76+
A_cmd->set_dest("msgpack://127.0.0.1:8007/", nullptr, "A");
7777
cmd_result = client->send_cmd_and_recv_result(std::move(A_cmd));
7878
TEN_ASSERT(TEN_STATUS_CODE_OK == cmd_result->get_status_code(),
7979
"Should not happen.");

tests/ten_runtime/integration/go/two_extension_one_group_cmd_go/client/client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int main(TEN_UNUSED int argc, TEN_UNUSED char **argv) {
5252

5353
TEN_LOGD("Got graph result.");
5454
auto A_cmd = ten::cmd_t::create("A");
55-
A_cmd->set_dest("msgpack://127.0.0.1:8007/", nullptr, "nodetest", "A");
55+
A_cmd->set_dest("msgpack://127.0.0.1:8007/", nullptr, "A");
5656
cmd_result = client->send_cmd_and_recv_result(std::move(A_cmd));
5757
TEN_ASSERT(TEN_STATUS_CODE_OK == cmd_result->get_status_code(),
5858
"Should not happen.");

0 commit comments

Comments
 (0)