[RFC] Wrapper/Proxy for Stream
See original GitHub issue🚀 Feature
Discussed with @NivekT about the wrapper class for all streams: Pros:
- We can add a
__del__
method to close the file stream automatically when ref count becomes 0 for wrapper. It would eliminate all warnings. - A wrapper class can unify the reading API for file streams. (For
OnDiskCache
, I would prefer a unified API to read stream, otherwise I have to handle all different cases)- Local file stream, we can use
read()
to read everything into memory - When we set
stream=True
for large file, therequests.Response
doesn’t supportread
. It only supportsiter_content
or__iter__
to read chunk by chunk.
- Local file stream, we can use
Cons:
- Thanks to @NivekT, it needs extra care about magic methods.
Reference: https://github.com/pytorch/data/pull/35#discussion_r728201731, https://github.com/pytorch/data/pull/65#discussion_r730117933
cc: @VitalyFedyunin
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
HTTP Live Streaming RFC 8216 - IETF Datatracker
HTTP Live Streaming (RFC 8216, August 2017)
Read more >RFC 2326: Real Time Streaming Protocol (RTSP)
Abstract The Real Time Streaming Protocol, or RTSP, is an application-level protocol for control over the delivery of data with real-time properties.
Read more >Re: [stunnel-users] stunnel tls wrapper/proxy for xmpp - stunnel ...
In an attempt to resolve the SSL issue, I re-compiled the debian finch package from experimental (had to fix a busted debian/control) and...
Read more >Newest 'wrapper' Questions - Page 7 - Stack Overflow
christopher.online's user avatar · christopher.online ... I am trying to calculate AES-MAC (RFC 4493) with Pkcs11 wrapper in java. and it seems that...
Read more >MENU - Linuxsecrets
1st April RFC 3093: http://ietf.org/rfc/rfc3093.txt. So-called Firewall Enhancement Protocol (FEP). ... TLS/SSL wrapper/proxy for FTP.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In the case of
Extractor
orDecompressor
the yielded file handle should also be wrapped by the Wrapper to make sure fd is closed automatically and have a unified API likeread
You are right with
Saver
. I am talking about reading data from file stream. The current workflow is:We can let user to do any map function to download data from file handle. But, if we are going to implement a DataPipe to do the same thing, we need to make sure all file handles (streams) sent to this DataPipe can be read.
The reason that I prefer a read method is the stream type varies:
".join(fd)"
b"".join(fd)