|
42 | 42 | from .sftp import SFTPAttrs, SFTPGlob, SFTPName, SFTPServer, SFTPServerFS
|
43 | 43 | from .sftp import SFTPFileProtocol, SFTPError, SFTPFailure, SFTPBadMessage
|
44 | 44 | from .sftp import SFTPConnectionLost, SFTPErrorHandler, SFTPProgressHandler
|
45 |
| -from .sftp import SFTP_BLOCK_SIZE, local_fs |
| 45 | +from .sftp import local_fs |
46 | 46 |
|
47 | 47 |
|
48 | 48 | if TYPE_CHECKING:
|
|
57 | 57 | _SCPConnPath = Union[Tuple[_SCPConn, _SCPPath], _SCPConn, _SCPPath]
|
58 | 58 |
|
59 | 59 |
|
| 60 | +_SCP_BLOCK_SIZE = 256*1024 # 256 KiB |
| 61 | + |
| 62 | + |
60 | 63 | class _SCPFSProtocol(Protocol):
|
61 | 64 | """Protocol for accessing a filesystem during an SCP copy"""
|
62 | 65 |
|
@@ -409,7 +412,7 @@ class _SCPSource(_SCPHandler):
|
409 | 412 |
|
410 | 413 | def __init__(self, fs: _SCPFSProtocol, reader: 'SSHReader[bytes]',
|
411 | 414 | writer: 'SSHWriter[bytes]', preserve: bool, recurse: bool,
|
412 |
| - block_size: int = SFTP_BLOCK_SIZE, |
| 415 | + block_size: int = _SCP_BLOCK_SIZE, |
413 | 416 | progress_handler: SFTPProgressHandler = None,
|
414 | 417 | error_handler: SFTPErrorHandler = None, server: bool = False):
|
415 | 418 | super().__init__(reader, writer, error_handler, server)
|
@@ -568,7 +571,7 @@ class _SCPSink(_SCPHandler):
|
568 | 571 |
|
569 | 572 | def __init__(self, fs: _SCPFSProtocol, reader: 'SSHReader[bytes]',
|
570 | 573 | writer: 'SSHWriter[bytes]', must_be_dir: bool, preserve: bool,
|
571 |
| - recurse: bool, block_size: int = SFTP_BLOCK_SIZE, |
| 574 | + recurse: bool, block_size: int = _SCP_BLOCK_SIZE, |
572 | 575 | progress_handler: SFTPProgressHandler = None,
|
573 | 576 | error_handler: SFTPErrorHandler = None, server: bool = False):
|
574 | 577 | super().__init__(reader, writer, error_handler, server)
|
@@ -736,7 +739,7 @@ def __init__(self, src_reader: 'SSHReader[bytes]',
|
736 | 739 | src_writer: 'SSHWriter[bytes]',
|
737 | 740 | dst_reader: 'SSHReader[bytes]',
|
738 | 741 | dst_writer: 'SSHWriter[bytes]',
|
739 |
| - block_size: int = SFTP_BLOCK_SIZE, |
| 742 | + block_size: int = _SCP_BLOCK_SIZE, |
740 | 743 | progress_handler: SFTPProgressHandler = None,
|
741 | 744 | error_handler: SFTPErrorHandler = None):
|
742 | 745 | self._source = _SCPHandler(src_reader, src_writer)
|
@@ -898,7 +901,7 @@ async def run(self) -> None:
|
898 | 901 |
|
899 | 902 | async def scp(srcpaths: Union[_SCPConnPath, Sequence[_SCPConnPath]],
|
900 | 903 | dstpath: _SCPConnPath = None, *, preserve: bool = False,
|
901 |
| - recurse: bool = False, block_size: int = SFTP_BLOCK_SIZE, |
| 904 | + recurse: bool = False, block_size: int = _SCP_BLOCK_SIZE, |
902 | 905 | progress_handler: SFTPProgressHandler = None,
|
903 | 906 | error_handler: SFTPErrorHandler = None, **kwargs) -> None:
|
904 | 907 | """Copy files using SCP
|
@@ -955,7 +958,7 @@ async def scp(srcpaths: Union[_SCPConnPath, Sequence[_SCPConnPath]],
|
955 | 958 | SFTP instead.
|
956 | 959 |
|
957 | 960 | The block_size value controls the size of read and write operations
|
958 |
| - issued to copy the files. It defaults to 16 KB. |
| 961 | + issued to copy the files. It defaults to 256 KB. |
959 | 962 |
|
960 | 963 | If progress_handler is specified, it will be called after each
|
961 | 964 | block of a file is successfully copied. The arguments passed to
|
|
0 commit comments