Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws-s3/s3.ml
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ module Make(Io : Types.Io) = struct
|> fun etag -> unquote etag
in
t.parts <- { etag; part_number } :: t.parts;
Deferred.return (Ok ())
Deferred.return (Ok etag)

(** Specify a part to be a file on s3.
[range] can be used to only include a part of the s3 file
Expand Down Expand Up @@ -616,7 +616,7 @@ module Make(Io : Types.Io) = struct
|> fun etag -> String.sub ~pos:1 ~len:(String.length etag - 2) etag
in
t.parts <- { etag; part_number } :: t.parts;
Deferred.return (Ok ())
Deferred.return (Ok etag)
end

end
Expand Down
4 changes: 2 additions & 2 deletions aws-s3/s3.mli
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ module Make(Io : Types.Io) : sig
?expect:bool ->
data:string ->
unit ->
unit result) command
etag result) command

(** Specify a part as a copy of an existing object in S3. *)
val copy_part :
Expand Down Expand Up @@ -255,7 +255,7 @@ module Make(Io : Types.Io) : sig
length:int ->
chunk_size:int ->
unit ->
unit result) command
etag result) command
end
end

Expand Down
7 changes: 5 additions & 2 deletions cli/aws.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,18 @@ module Make(Io : Aws_s3.Types.Io) = struct
| (false, false) -> failwith "Use cp(1)"

let rec upload_parts t endpoint ~retries ~expect ~credentials ?(offset=0) ~total ?(part_number=1) ?chunk_size src =
let ignore_result = Result.map ignore in
let f ~size ~endpoint ()=
match chunk_size with
| None ->
let data = read_file ~pos:offset ~len:size src in
S3.Multipart_upload.upload_part ~endpoint ~expect ~credentials t ~part_number ~data ()
S3.Multipart_upload.upload_part ~endpoint ~expect ~credentials t ~part_number ~data () >>|
ignore_result
| Some chunk_size ->
(* Create a reader for this section *)
let reader = file_reader ~pos:offset ~len:size src in
S3.Multipart_upload.Stream.upload_part ~endpoint ~expect ~credentials t ~part_number ~data:reader ~chunk_size ~length:size ()
S3.Multipart_upload.Stream.upload_part ~endpoint ~expect ~credentials t ~part_number ~data:reader ~chunk_size ~length:size () >>|
ignore_result
in
match (total - offset) with
| 0 -> []
Expand Down
Loading