Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7ed76243
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ed76243
编写于
4月 15, 2022
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
after trying to retrive udf info from mnode
上级
5ea40c9d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
76 addition
and
1 deletion
+76
-1
source/dnode/mnode/impl/test/func/func.cpp
source/dnode/mnode/impl/test/func/func.cpp
+1
-1
source/libs/function/CMakeLists.txt
source/libs/function/CMakeLists.txt
+1
-0
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+74
-0
未找到文件。
source/dnode/mnode/impl/test/func/func.cpp
浏览文件 @
7ed76243
...
...
@@ -230,7 +230,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) {
EXPECT_EQ
(
retrieveRsp
.
numOfFuncs
,
1
);
EXPECT_EQ
(
retrieveRsp
.
numOfFuncs
,
(
int32_t
)
taosArrayGetSize
(
retrieveRsp
.
pFuncInfos
));
SFuncInfo
*
pFuncInfo
=
(
SFuncInfo
*
)
taosArrayGet
(
retrieveRsp
.
pFuncInfos
,
0
);
*
pFuncInfo
=
(
SFuncInfo
*
)
taosArrayGet
(
retrieveRsp
.
pFuncInfos
,
0
);
EXPECT_STREQ
(
pFuncInfo
->
name
,
"f1"
);
EXPECT_EQ
(
pFuncInfo
->
funcType
,
1
);
...
...
source/libs/function/CMakeLists.txt
浏览文件 @
7ed76243
...
...
@@ -57,6 +57,7 @@ target_include_directories(
"
${
TD_SOURCE_DIR
}
/contrib/libuv/include"
"
${
TD_SOURCE_DIR
}
/include/util"
"
${
TD_SOURCE_DIR
}
/include/common"
"
${
TD_SOURCE_DIR
}
/include/libs/transport"
"
${
TD_SOURCE_DIR
}
/include/client"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
...
...
source/libs/function/src/udfd.c
浏览文件 @
7ed76243
...
...
@@ -20,6 +20,10 @@
#include "tudf.h"
#include "tudfInt.h"
#include "tdataformat.h"
#include "tglobal.h"
#include "tmsg.h"
#include "trpc.h"
static
uv_loop_t
*
loop
;
...
...
@@ -319,6 +323,76 @@ void removeListeningPipe(int sig) {
exit
(
0
);
}
typedef
struct
SServerContext
{
void
*
clientRpc
;
}
SUdfdContext
;
void
udfdProcessRpcRsp
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
return
;
}
int32_t
fetchUdfFuncInfo
(
void
*
clientRpc
,
SEpSet
*
pEpSet
,
char
*
udfNames
[],
int32_t
numOfUdfs
)
{
SRetrieveFuncReq
retrieveReq
=
{
0
};
retrieveReq
.
numOfFuncs
=
1
;
retrieveReq
.
pFuncNames
=
taosArrayInit
(
1
,
TSDB_FUNC_NAME_LEN
);
for
(
int32_t
i
=
0
;
i
<
numOfUdfs
;
++
i
)
{
taosArrayPush
(
retrieveReq
.
pFuncNames
,
udfNames
[
i
]);
}
int32_t
contLen
=
tSerializeSRetrieveFuncReq
(
NULL
,
0
,
&
retrieveReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSRetrieveFuncReq
(
pReq
,
contLen
,
&
retrieveReq
);
taosArrayDestroy
(
retrieveReq
.
pFuncNames
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
contLen
;
rpcMsg
.
msgType
=
TDMT_MND_RETRIEVE_FUNC
;
SRpcMsg
rpcRsp
=
{
0
};
rpcSendRecv
(
clientRpc
,
pEpSet
,
&
rpcMsg
,
&
rpcRsp
);
SRetrieveFuncRsp
retrieveRsp
=
{
0
};
tDeserializeSRetrieveFuncRsp
(
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
&
retrieveRsp
);
SFuncInfo
*
pFuncInfo
=
(
SFuncInfo
*
)
taosArrayGet
(
retrieveRsp
.
pFuncInfos
,
0
);
taosArrayDestroy
(
retrieveRsp
.
pFuncInfos
);
rpcFreeCont
(
rpcRsp
.
pCont
);
return
0
;
}
int32_t
openUdfdClientRpc
(
SUdfdContext
*
ctx
)
{
char
*
pass
=
"taosdata"
;
char
*
user
=
"root"
;
char
secretEncrypt
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
SRpcInit
rpcInit
=
{
0
};
rpcInit
.
label
=
(
char
*
)
"UDFD"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
udfdProcessRpcRsp
;
rpcInit
.
sessions
=
1024
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
30
*
1000
;
rpcInit
.
parent
=
ctx
;
rpcInit
.
user
=
(
char
*
)
user
;
rpcInit
.
ckey
=
(
char
*
)
"key"
;
rpcInit
.
secret
=
(
char
*
)
secretEncrypt
;
rpcInit
.
spi
=
1
;
ctx
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
return
0
;
}
int32_t
closeUdfdClientRpc
(
SUdfdContext
*
ctx
)
{
rpcClose
(
ctx
->
clientRpc
);
return
0
;
}
int
main
()
{
debugPrint
(
"libuv version: %x"
,
UV_VERSION_HEX
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录