summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpengxuanzheng <[email protected]>2020-10-14 15:23:01 +0800
committerpengxuanzheng <[email protected]>2020-11-02 19:00:02 +0800
commit3f38cefc5ee10e0e0814a4ee4b94cfe1e0b5a34b (patch)
treed922d1f3fe63e7273aca1721bc73ef79e25279b0 /src
parent8a35250d2127feabf66fb536838043a13a32f7d1 (diff)
增加 performan 测试
Diffstat (limited to 'src')
-rw-r--r--src/hos_client.cpp11
-rw-r--r--src/hos_client.h4
2 files changed, 7 insertions, 8 deletions
diff --git a/src/hos_client.cpp b/src/hos_client.cpp
index f49bf9ff..b4e91867 100644
--- a/src/hos_client.cpp
+++ b/src/hos_client.cpp
@@ -80,14 +80,14 @@ static void PutObjectAsyncFinished(const Aws::S3::S3Client* S3Client,
}
}
-hos_client_handle hos_client_create(const char *endpoint, const char *accesskeyid, const char *secretkey, size_t thread_sum)
+hos_client_handle hos_client_create(const char *endpoint, const char *accesskeyid, const char *secretkey, size_t thread_sum, size_t pool_size)
{
if (!endpoint || !accesskeyid || !secretkey || thread_sum > MAX_THREAD_NUM)
{
return NULL;
}
Aws::SDKOptions options;
- //auto options = new Aws::SDKOptions;
+ //options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug;
Aws::InitAPI(options);
hos_client_handle handle = (hos_client_handle)malloc(sizeof(hos_client_handle_t));
@@ -99,7 +99,7 @@ hos_client_handle hos_client_create(const char *endpoint, const char *accesskeyi
config.endpointOverride = endpoint;
config.verifySSL = false;
config.enableEndpointDiscovery = true;
- config.executor = std::shared_ptr<Aws::Utils::Threading::PooledThreadExecutor>(std::make_shared<Aws::Utils::Threading::PooledThreadExecutor>(100));//支持线程池
+ config.executor = std::shared_ptr<Aws::Utils::Threading::PooledThreadExecutor>(std::make_shared<Aws::Utils::Threading::PooledThreadExecutor>(pool_size));//支持线程池
handle->S3Client = new Aws::S3::S3Client(credentials, config, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, false);
handle->append_size = 30 * 1024 * 1024;
@@ -192,7 +192,7 @@ static int hos_upload_stream(hos_client_handle handle, const char *bucket, const
//设置上传数据类型
if (file_type == 0)
{
- if (stat(object, &buffer) == -1)
+ if (stat(data, &buffer) == -1)
{
return HOS_FILE_NOT_EXITS;
}
@@ -317,8 +317,7 @@ int hos_write(size_t fd, const char *stream, size_t stream_len, size_t thread_id
}
else
{
- //BUFF_MODE
- if (stat(hos_info->object, &buffer) == -1)
+ if (stat(stream, &buffer) == -1)
{
return HOS_FILE_NOT_EXITS;
}
diff --git a/src/hos_client.h b/src/hos_client.h
index d1cb7db5..668af9fd 100644
--- a/src/hos_client.h
+++ b/src/hos_client.h
@@ -80,9 +80,9 @@ typedef void (*put_finished_callback)(bool, const char *, void *);
* const char *accesskeyid AWS access key ID,如”default“
* const char *secretkey AWS secret key,如”default“
* size_t thread_sum 线程总数
- * 返回值: 成功返回一个非空句柄,失败返回NULL。(失败原因都是因为输入参数为空)
+ * 返回值: 成功返回一个非空句柄,失败返回NULL。(失败原因都是因为输入参数不合法)
*************************************************************************************/
-hos_client_handle hos_client_create(const char *endpoint, const char *accesskeyid, const char *secretkey, size_t thread_sum);
+hos_client_handle hos_client_create(const char *endpoint, const char *accesskeyid, const char *secretkey, size_t thread_sum, size_t pool_size);
/*************************************************************************************
* 函数名: hos_create_bucket
* 参数: hos_client_handle handle 非空句柄