tcs: fix mac stb link issue

This commit is contained in:
Minglei Jin 2024-10-16 16:44:08 +08:00
parent af6ff0dd6a
commit b05784f524
5 changed files with 72 additions and 10 deletions

View File

@ -49,13 +49,13 @@ static void azDumpCfgByEp(int8_t epIndex) {
"%-24s %s\n"
"%-24s %s\n"
"%-24s %s\n"
// "%-24s %s\n"
"%-24s %s\n"
"%-24s %s\n"
"%-24s %s\n",
"hostName", tsS3Hostname[epIndex],
"bucketName", tsS3BucketName,
"protocol", "https only",
//"uristyle", (uriStyleG[epIndex] == S3UriStyleVirtualHost ? "virtualhost" : "path"),
"uristyle", "path only",
"accessKey", tsS3AccessKeyId[epIndex],
"accessKeySecret", tsS3AccessKeySecret[epIndex]);
// clang-format on

View File

@ -13,7 +13,7 @@ if(${BUILD_WITH_ROCKSDB})
target_link_libraries(
stream
PUBLIC rocksdb tdb
PRIVATE os util transport qcom executor wal index
PRIVATE os util transport qcom executor wal index tcs
)
target_include_directories(
stream
@ -32,13 +32,13 @@ if(${BUILD_WITH_ROCKSDB})
target_link_libraries(
stream
PUBLIC rocksdb tdb
PRIVATE os util transport qcom executor wal index
PRIVATE os util transport qcom executor wal index tcs
)
else()
target_link_libraries(
stream
PUBLIC rocksdb tdb
PRIVATE os util transport qcom executor wal index
PRIVATE os util transport qcom executor wal index tcs
)
target_include_directories(
stream

View File

@ -1,6 +1,6 @@
aux_source_directory(src TOS_SRC)
aux_source_directory(src TCS_SRC)
add_library(tcs STATIC ${TOS_SRC})
add_library(tcs STATIC ${TCS_SRC})
target_include_directories(
tcs
PUBLIC "${TD_SOURCE_DIR}/include/libs/tcs"

View File

@ -43,6 +43,7 @@ int32_t tcsInit() {
tcs.GetObjectsByPrefix = s3GetObjectsByPrefix;
tcs.DeleteObjects = s3DeleteObjects;
tcs.GetObjectToFile = s3GetObjectToFile;
} else if (TOS_PROTO_ABLOB == proto) {
tcs.Begin = azBegin;
tcs.End = azEnd;
@ -74,19 +75,19 @@ int32_t tcsCheckCfg() {
int32_t code = 0;
if (!tsS3Enabled) {
(void)fprintf(stderr, "s3 not configured.\n");
(void)fprintf(stderr, "tcs not configured.\n");
TAOS_RETURN(code);
}
code = tcsInit();
if (code != 0) {
(void)fprintf(stderr, "failed to initialize s3.\n");
(void)fprintf(stderr, "failed to initialize tcs.\n");
TAOS_RETURN(code);
}
code = tcs.CheckCfg();
if (code != 0) {
(void)fprintf(stderr, "failed to check s3.\n");
(void)fprintf(stderr, "failed to check tcs.\n");
TAOS_RETURN(code);
}

View File

@ -2,6 +2,67 @@
#include <cstring>
#include <iostream>
#include <queue>
#include "tcs.h"
int32_t tcsInitEnv() {
int32_t code = 0;
extern char tsS3Hostname[][TSDB_FQDN_LEN];
extern char tsS3AccessKeyId[][TSDB_FQDN_LEN];
extern char tsS3AccessKeySecret[][TSDB_FQDN_LEN];
extern char tsS3BucketName[TSDB_FQDN_LEN];
/* TCS parameter format
tsS3Hostname[0] = "endpoint/<account-name>.blob.core.windows.net";
tsS3AccessKeyId[0] = "<access-key-id/account-name>";
tsS3AccessKeySecret[0] = "<access-key-secret/account-key>";
tsS3BucketName = "<bucket/container-name>";
*/
tsS3Enabled = true;
return code;
}
// TEST(TcsTest, DISABLE_InterfaceTest) {
TEST(TcsTest, InterfaceTest) {
int code = 0;
if (!tsS3Enabled) {
(void)fprintf(stderr, "tcs not configured.\n");
return;
}
code = tcsInit();
GTEST_ASSERT_EQ(code, 0);
code = tcsCheckCfg();
GTEST_ASSERT_EQ(code, 0);
/*
code = tcsPutObjectFromFileOffset(file, object_name, offset, size);
GTEST_ASSERT_EQ(code, 0);
code = tcsGetObjectBlock(object_name, offset, size, check, ppBlock);
GTEST_ASSERT_EQ(code, 0);
tcsDeleteObjectsByPrefix(prefix);
// list object to check
code = tcsPutObjectFromFile2(file, object, withcp);
GTEST_ASSERT_EQ(code, 0);
code = tcsGetObjectsByPrefix(prefix, path);
GTEST_ASSERT_EQ(code, 0);
code = tcsDeleteObjects(object_name, nobject);
GTEST_ASSERT_EQ(code, 0);
code = tcsGetObjectToFile(object_name, fileName);
GTEST_ASSERT_EQ(code, 0);
// GTEST_ASSERT_NE(pEnv, nullptr);
*/
tcsUninit();
}
/*
#include "walInt.h"
const char* ranStr = "tvapq02tcp";