11local httplib = require (" pipe.httplib" )
22local strutil = require (" acid.strutil" )
3+ local tableutil = require (" acid.tableutil" )
34local rpc_logging = require (" acid.rpc_logging" )
45local acid_setutil = require (" acid.setutil" )
56local s3_client = require (' resty.aws_s3.client' )
@@ -255,7 +256,7 @@ function _M.make_quorum_http_writers(dests, writer_opts, quorum)
255256 return nil , ' NotEnoughConnect' , to_str (' quorum:' , quorum , " , actual:" , n_ok )
256257end
257258
258- function _M .make_aws_put_s3_writer (access_key , secret_key , endpoint , params , opts )
259+ function _M .make_put_s3_writer (access_key , secret_key , endpoint , params , opts )
259260 local s3_cli , err_code , err_msg =
260261 s3_client .new (access_key , secret_key , endpoint , opts )
261262 if err_code ~= nil then
@@ -269,8 +270,11 @@ function _M.make_aws_put_s3_writer(access_key, secret_key, endpoint, params, opt
269270 end
270271
271272 return function (pobj , ident )
272- local chunk_writer =
273- aws_chunk_writer :new (request .signer , request .auth_ctx )
273+ local chunk_writer
274+ if opts .aws_chunk == true then
275+ chunk_writer =
276+ aws_chunk_writer :new (request .signer , request .auth_ctx )
277+ end
274278
275279 local _ , err_code , err_msg = s3_cli :send_request (
276280 request .verb , request .uri , request .headers ,request .body )
@@ -284,8 +288,12 @@ function _M.make_aws_put_s3_writer(access_key, secret_key, endpoint, params, opt
284288 return nil , err_code , err_msg
285289 end
286290
287- local chunked_data = chunk_writer :make_chunk (data )
288- local _ , err_code , err_msg = s3_cli :send_body (chunked_data )
291+ local send_data = data
292+ if opts .aws_chunk == true then
293+ send_data = chunk_writer :make_chunk (send_data )
294+ end
295+
296+ local _ , err_code , err_msg = s3_cli :send_body (send_data )
289297 if err_code ~= nil then
290298 return nil , err_code , err_msg
291299 end
@@ -299,4 +307,11 @@ function _M.make_aws_put_s3_writer(access_key, secret_key, endpoint, params, opt
299307 end
300308end
301309
310+ function _M .make_aws_put_s3_writer (access_key , secret_key , endpoint , params , opts )
311+ opts = tableutil .dup (opts or {}, true )
312+ opts .aws_chunk = true
313+
314+ return _M .make_put_s3_writer (access_key , secret_key , endpoint , params , opts )
315+ end
316+
302317return _M
0 commit comments