Module Awskit_s3.Transfer

High-level S3 transfer configuration shared by object transfer helpers.

Transfer options cover strategy selection, local file behavior, and the S3 operation option records used by helper implementations. Retry and timeout policies remain client/runtime construction policy; transfer helpers execute ordinary S3 operations through that configured client instead of carrying separate per-transfer retry or timeout placeholders.

val min_part_size : int

Minimum multipart part size accepted by S3, except for the final part.

val default_part_size : int

Default multipart transfer part size in bytes.

val default_multipart_threshold : int64

Default object size at which high-level helpers switch from a single request to multipart/ranged transfer.

val default_concurrency : int

Default number of concurrent part operations for helpers that can use parallel transfer.

val max_parts : int

Maximum number of parts supported by S3 multipart upload.

type direction =
  1. | Upload
  2. | Download

Direction reported by transfer progress callbacks.

type phase =
  1. | Single_request
  2. | Part
  3. | Ranged_get

Transfer phase reported by progress callbacks.

Single_request is used by ordinary PutObject and GetObject helpers, Part by multipart upload parts, and Ranged_get by ranged download helpers.

type progress = {
  1. direction : direction;
  2. phase : phase;
  3. transferred : int64;
  4. total : int64 option;
  5. part_number : Multipart.Part_number.t option;
}

Structured progress event. transferred is cumulative for the current helper invocation.

type upload_options = private {
  1. multipart_threshold : int64;
    (*

    Object size at or above which high-level upload helpers use multipart upload.

    *)
  2. part_size : int;
    (*

    Multipart part size in bytes.

    *)
  3. concurrency : int;
    (*

    Maximum number of in-flight part operations for capable adapters.

    *)
  4. put_options : Object.Put.options;
    (*

    Options used by single-request PutObject uploads.

    *)
  5. create_options : Multipart.Create.options;
    (*

    Options used by CreateMultipartUpload.

    *)
  6. upload_part_options : Multipart.Upload_part.options;
    (*

    Options used by each UploadPart.

    *)
  7. complete_options : Multipart.Complete.options;
    (*

    Options used by CompleteMultipartUpload.

    *)
  8. abort_options : Multipart.Abort.options;
    (*

    Options used when aborting a failed Awskit-created multipart upload.

    *)
  9. list_parts_options : Multipart.List_parts.options;
    (*

    Options used when verifying caller-owned uploads before resumed file transfer writes fresh parts.

    *)
}

High-level upload behavior. put_options are used for single-request uploads; multipart option records are used when the selected strategy is multipart or when writing into a caller-owned upload.

type overwrite =
  1. | Replace
  2. | Error_if_exists

Local target behavior for high-level download helpers.

Replace publishes the completed temporary download over an existing target. Error_if_exists rejects an existing target before transport.

type download_options = private {
  1. multipart_threshold : int64;
    (*

    Object size at or above which high-level download helpers use ranged requests.

    *)
  2. part_size : int;
    (*

    Range size in bytes for ranged downloads.

    *)
  3. concurrency : int;
    (*

    Maximum number of in-flight range requests for capable adapters.

    *)
  4. overwrite : overwrite;
    (*

    Local target overwrite policy.

    *)
  5. get_options : Object.Get.options;
    (*

    Options used by GetObject and ranged GetObject requests.

    *)
}

High-level download behavior. get_options are used for both single GetObject downloads and ranged downloads.

type upload_strategy = [
  1. | `Put
  2. | `Multipart
]

Strategy used by a high-level upload result.

type download_strategy = [
  1. | `Get
  2. | `Ranged
]

Strategy used by a high-level download result.

type put_upload_result = {
  1. put : Object.Put.result;
    (*

    Metadata returned by the underlying PutObject request.

    *)
  2. bytes_transferred : int64;
    (*

    Number of local file bytes streamed into the request body.

    *)
}

Result of a single-request upload.

type multipart_upload_result = {
  1. upload : Multipart.Upload.caller_owned Multipart.Upload.t;
    (*

    Caller-owned handle describing the upload that was completed.

    *)
  2. parts : Multipart.Part.t list;
    (*

    Completed parts in ascending part-number order.

    *)
  3. complete : Multipart.Complete.result;
    (*

    Metadata returned by CompleteMultipartUpload.

    *)
  4. bytes_transferred : int64;
    (*

    Number of local file bytes streamed into multipart part requests.

    *)
}

Result of a completed multipart upload.

type upload_result =
  1. | Put of put_upload_result
  2. | Multipart of multipart_upload_result
    (*

    High-level upload result, tagged by the strategy actually used.

    *)
type get_download_result = {
  1. info : Object.Get.info;
    (*

    Metadata returned by the underlying GetObject request.

    *)
  2. bytes_transferred : int64;
    (*

    Number of response-body bytes streamed into the local file.

    *)
}

Result of a single-request download.

type ranged_download_result = {
  1. info : Object.Head.result;
    (*

    Metadata captured before ranged GetObject requests.

    *)
  2. parts : int;
    (*

    Number of ranges downloaded.

    *)
  3. bytes_transferred : int64;
    (*

    Number of response-body bytes streamed into the local file.

    *)
}

Result of a ranged download.

type download_result =
  1. | Get of get_download_result
  2. | Ranged of ranged_download_result
    (*

    High-level download result. Ranged downloads include the initial HeadObject metadata and the number of downloaded ranges.

    *)
val upload_strategy : upload_result -> upload_strategy

Return the strategy used by an upload helper result.

val download_strategy : download_result -> download_strategy

Return the strategy used by a download helper result.

val upload_bytes_transferred : upload_result -> int64

Return the number of local file bytes streamed by an upload helper.

val download_bytes_transferred : download_result -> int64

Return the number of response-body bytes streamed by a download helper.

val default_upload_options : upload_options

Default high-level upload options.

val default_download_options : download_options

Default high-level download options.

val progress : direction:direction -> phase:phase -> transferred:int64 -> ?total:int64 -> ?part_number:Multipart.Part_number.t -> unit -> progress

Build a structured transfer progress event.

val upload_options : ?multipart_threshold:int64 -> ?part_size:int -> ?concurrency:int -> ?put_options:Object.Put.options -> ?create_options:Multipart.Create.options -> ?upload_part_options:Multipart.Upload_part.options -> ?complete_options:Multipart.Complete.options -> ?abort_options:Multipart.Abort.options -> ?list_parts_options:Multipart.List_parts.options -> unit -> (upload_options, Awskit.Error.t) Stdlib.result

Build and validate high-level upload options.

val upload_options_exn : ?multipart_threshold:int64 -> ?part_size:int -> ?concurrency:int -> ?put_options:Object.Put.options -> ?create_options:Multipart.Create.options -> ?upload_part_options:Multipart.Upload_part.options -> ?complete_options:Multipart.Complete.options -> ?abort_options:Multipart.Abort.options -> ?list_parts_options:Multipart.List_parts.options -> unit -> upload_options

Like upload_options, but raises Awskit.Error.Awskit_error carrying the structured validation error on validation failure.

val download_options : ?multipart_threshold:int64 -> ?part_size:int -> ?concurrency:int -> ?overwrite:overwrite -> ?get_options:Object.Get.options -> unit -> (download_options, Awskit.Error.t) Stdlib.result

Build and validate high-level download options.

val download_options_exn : ?multipart_threshold:int64 -> ?part_size:int -> ?concurrency:int -> ?overwrite:overwrite -> ?get_options:Object.Get.options -> unit -> download_options

Like download_options, but raises Awskit.Error.Awskit_error carrying the structured validation error on validation failure.

val upload_multipart_threshold : upload_options -> int64

Return the upload multipart-selection threshold in bytes.

val upload_part_size : upload_options -> int

Return the upload multipart part size in bytes.

val upload_concurrency : upload_options -> int

Return the maximum in-flight upload part operation count.

val upload_put_options : upload_options -> Object.Put.options

Return options used by single-request PutObject uploads.

val upload_create_options : upload_options -> Multipart.Create.options

Return options used by CreateMultipartUpload.

val upload_part_options : upload_options -> Multipart.Upload_part.options

Return options used by each UploadPart.

val upload_complete_options : upload_options -> Multipart.Complete.options

Return options used by CompleteMultipartUpload.

val upload_abort_options : upload_options -> Multipart.Abort.options

Return options used when aborting an Awskit-created multipart upload after a helper failure.

val upload_list_parts_options : upload_options -> Multipart.List_parts.options

Return options used to verify a caller-owned upload before resumed multipart transfer.

val download_multipart_threshold : download_options -> int64

Return the download ranged-transfer threshold in bytes.

val download_part_size : download_options -> int

Return the range size in bytes for ranged downloads.

val download_concurrency : download_options -> int

Return the maximum in-flight ranged GetObject operation count.

val download_overwrite : download_options -> overwrite

Return the local target overwrite policy.

val download_get_options : download_options -> Object.Get.options

Return options used by single-request and ranged GetObject downloads.

val validate_upload_options : upload_options -> (unit, Awskit.Error.t) Stdlib.result

Validate upload thresholds, part size, concurrency, and nested options.

val validate_upload_multipart_selection : upload_options -> (unit, Awskit.Error.t) Stdlib.result

Validate that multipart-specific settings are usable when multipart upload is selected.

val validate_download_options : download_options -> (unit, Awskit.Error.t) Stdlib.result

Validate download thresholds, part size, and concurrency.

val validate_multipart_part_count : content_length:int64 -> part_size:int -> (unit, Awskit.Error.t) Stdlib.result

Check that content_length can be represented within S3's maximum part count for part_size.

module Plan : sig ... end