Get a chunksize close to current that fits within all S3 limits. :type current_chunksize: int :param current_chunksize: The currently configured chunksize. :type file_size: int or None :param file_size: The size of the file to upload. This might be None
(self, current_chunksize, file_size=None)
| 761 | self.max_parts = max_parts |
| 762 | |
| 763 | def adjust_chunksize(self, current_chunksize, file_size=None): |
| 764 | """Get a chunksize close to current that fits within all S3 limits. |
| 765 | |
| 766 | :type current_chunksize: int |
| 767 | :param current_chunksize: The currently configured chunksize. |
| 768 | |
| 769 | :type file_size: int or None |
| 770 | :param file_size: The size of the file to upload. This might be None |
| 771 | if the object being transferred has an unknown size. |
| 772 | |
| 773 | :returns: A valid chunksize that fits within configured limits. |
| 774 | """ |
| 775 | chunksize = current_chunksize |
| 776 | if file_size is not None: |
| 777 | chunksize = self._adjust_for_max_parts(chunksize, file_size) |
| 778 | return self._adjust_for_chunksize_limits(chunksize) |
| 779 | |
| 780 | def _adjust_for_chunksize_limits(self, current_chunksize): |
| 781 | if current_chunksize > self.max_size: |