Debian Codegraph @

lib/3rdParty/composer/aws/aws-sdk-php/src/S3/S3Transfer/Models/S3TransferManagerConfig.php

raw symbols SCIP
1 <?php
2
3 namespace Aws\S3\S3Transfer\Models;
4
5 final class S3TransferManagerConfig
6 {
7 public const DEFAULT_TARGET_PART_SIZE_BYTES = 8388608; // 8MB
8 public const DEFAULT_MULTIPART_UPLOAD_THRESHOLD_BYTES = 16777216; // 16MB
9 public const DEFAULT_REQUEST_CHECKSUM_CALCULATION = 'when_supported';
10 public const DEFAULT_RESPONSE_CHECKSUM_VALIDATION = 'when_supported';
11 public const DEFAULT_MULTIPART_DOWNLOAD_TYPE = 'part';
12 public const DEFAULT_CONCURRENCY = 5;
13 private const DEFAULT_TRACK_PROGRESS = false;
14
15 /** @var int */
16 private int $targetPartSizeBytes;
17
18 /** @var int */
19 private int $multipartUploadThresholdBytes;
20
21 /** @var string */
22 private string $requestChecksumCalculation;
23
24 /** @var string */
25 private string $responseChecksumValidation;
26
27 /** @var string */
28 private string $multipartDownloadType;
29
30 /** @var int */
31 private int $concurrency;
32
33 /** @var bool */
34 private bool $trackProgress;
35
36 /** @var string|null */
37 private ?string $defaultRegion;
38
39 /**
40 * @param int $targetPartSizeBytes
41 * @param int $multipartUploadThresholdBytes
42 * @param string $requestChecksumCalculation
43 * @param string $responseChecksumValidation
44 * @param string $multipartDownloadType
45 * @param int $concurrency
46 * @param bool $trackProgress
47 * @param string|null $defaultRegion
48 */
49 public function __construct(
50 int $targetPartSizeBytes,
51 int $multipartUploadThresholdBytes,
52 string $requestChecksumCalculation,
53 string $responseChecksumValidation,
54 string $multipartDownloadType,
55 int $concurrency,
56 bool $trackProgress,
57 ?string $defaultRegion
58 ) {
59 $this->targetPartSizeBytes = $targetPartSizeBytes;
60 $this->multipartUploadThresholdBytes = $multipartUploadThresholdBytes;
61 $this->requestChecksumCalculation = $requestChecksumCalculation;
62 $this->responseChecksumValidation = $responseChecksumValidation;
63 $this->multipartDownloadType = $multipartDownloadType;
64 $this->concurrency = $concurrency;
65 $this->trackProgress = $trackProgress;
66 $this->defaultRegion = $defaultRegion;
67 }
68
69 /** $config:
70 * - target_part_size_bytes: (int, default=(8388608 `8MB`))
71 * The minimum part size to be used in a multipart upload/download.
72 * - multipart_upload_threshold_bytes: (int, default=(16777216 `16 MB`))
73 * The threshold to decided whether a multipart upload is needed.
74 * - request_checksum_calculation: (string, default=`when_supported`)
75 * To decide whether a checksum validation will be applied to the response.
76 * - response_checksum_validation: (string, default=`when_supported`)
77 * - multipart_download_type: (string, default='part')
78 * The download type to be used in a multipart download.
79 * - concurrency: (int, default=5)
80 * Maximum number of concurrent operations allowed during a multipart
81 * upload/download.
82 * - track_progress: (bool, default=false)
83 * To enable progress tracker in a multipart upload/download, and or
84 * a directory upload/download operation.
85 * - default_region: (string, default="us-east-2")
86 */
87 public static function fromArray(array $config): self {
88 return new self(
89 $config['target_part_size_bytes']
90 ?? self::DEFAULT_TARGET_PART_SIZE_BYTES,
91 $config['multipart_upload_threshold_bytes']
92 ?? self::DEFAULT_MULTIPART_UPLOAD_THRESHOLD_BYTES,
93 $config['request_checksum_calculation']
94 ?? self::DEFAULT_REQUEST_CHECKSUM_CALCULATION,
95 $config['response_checksum_validation']
96 ?? self::DEFAULT_RESPONSE_CHECKSUM_VALIDATION,
97 $config['multipart_download_type']
98 ?? self::DEFAULT_MULTIPART_DOWNLOAD_TYPE,
99 $config['concurrency']
100 ?? self::DEFAULT_CONCURRENCY,
101 $config['track_progress'] ?? self::DEFAULT_TRACK_PROGRESS,
102 $config['default_region'] ?? null
103 );
104 }
105
106 /**
107 * @return int
108 */
109 public function getTargetPartSizeBytes(): int
110 {
111 return $this->targetPartSizeBytes;
112 }
113
114 /**
115 * @return int
116 */
117 public function getMultipartUploadThresholdBytes(): int
118 {
119 return $this->multipartUploadThresholdBytes;
120 }
121
122 /**
123 * @return string
124 */
125 public function getRequestChecksumCalculation(): string
126 {
127 return $this->requestChecksumCalculation;
128 }
129
130 /**
131 * @return string
132 */
133 public function getResponseChecksumValidation(): string
134 {
135 return $this->responseChecksumValidation;
136 }
137
138 /**
139 * @return string
140 */
141 public function getMultipartDownloadType(): string
142 {
143 return $this->multipartDownloadType;
144 }
145
146 /**
147 * @return int
148 */
149 public function getConcurrency(): int
150 {
151 return $this->concurrency;
152 }
153
154 /**
155 * @return bool
156 */
157 public function isTrackProgress(): bool
158 {
159 return $this->trackProgress;
160 }
161
162 /**
163 * @return string|null
164 */
165 public function getDefaultRegion(): ?string
166 {
167 return $this->defaultRegion;
168 }
169
170 /**
171 * @return array
172 */
173 public function toArray(): array
174 {
175 return [
176 'target_part_size_bytes' => $this->targetPartSizeBytes,
177 'multipart_upload_threshold_bytes' => $this->multipartUploadThresholdBytes,
178 'request_checksum_calculation' => $this->requestChecksumCalculation,
179 'response_checksum_validation' => $this->responseChecksumValidation,
180 'multipart_download_type' => $this->multipartDownloadType,
181 'concurrency' => $this->concurrency,
182 'track_progress' => $this->trackProgress,
183 'default_region' => $this->defaultRegion,
184 ];
185 }
186 }