fsspec / fsspec/filesystem_spec
SFTPFile(AbstractBufferedFile) for sparse access to remote file over ssh
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 490
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 38
Description
Ref: https://github.com/fsspec/filesystem_spec/issues/748 which I found while also wondering about AttributeError: 'SFTPFile' object has no attribute 'blocksize' error ;-)
I guess there is no "sparse" cache due to not implemented "range" request support for sftp as it is done for e.g. HTTPFile?
But it seems that sftp itself does allow for range requests, e.g.:
$> curl --silent --range 0-0,-1 sftp://yoh@secret.datalad.org:2222/home/yoh/c4057c5e-7af5-4370-878f-ccfc971aeba4 | hexdump
0000000 0089
0000001
so I guess it should be well be possible provide such support in fsspec... didn't look in detail yet anywhere but paramiko does seems to support the seekable BufferedFile
$> git grep -p 'def seek'
paramiko/_winapi.py=class MemoryMap(object):
paramiko/_winapi.py: def seek(self, pos):
paramiko/file.py=class BufferedFile(ClosingContextManager):
paramiko/file.py: def seekable(self):
paramiko/file.py: def seek(self, offset, whence=0):
paramiko/sftp_file.py=class SFTPFile(BufferedFile):
paramiko/sftp_file.py: def seekable(self):
paramiko/sftp_file.py: def seek(self, offset, whence=0):
so may be it is really just a quick patch away? ;)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mentioned paramiko/file.py and paramiko/sftp_file.py seek implementations, then trace fsspec's HTTPFile sparse-cache behavior for comparison. Define how SFTP range access should integrate with the existing filesystem interface, including the reported blocksize behavior, and verify sparse remote reads before considering the issue complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100