| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
type-traits _v and _t; Use std::string::starts_with(); Use std::numbers::pi_v
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
jau::io::ByteInStream_[URL|Feed]'s available() and read() operation.
jau::ringbuffer: Add 'End of Stream' (EOS) concept to unblock all read-operations from this point onwards
and unblocking a potentially currently blocked reader thread.
The EOS concept is required to allow blocking operations from a consumer (reader) w/o knowledge of the content-size,
having the producer (writer) signaling EOS at the end and unblocking all read-operations.
Fuerther, after unblocking a potentially blocker reader-thread,
the failure criteria is now being checked as for the `timeout` case.
This allows a read-thread being unblocked (interrupted) after writing the last chunk
and hence picking up this last written data.
+++
Utilize ringbuffer EOS concept for jau::io::ByteInStream_[URL|Feed]'s available() and read() operation,
i.e. both methods utilize blocking operations.
After the producer (URL: Our Curl consume callback; Feed: Manual set_eof()) marks EOS on the ringbuffer,
all blocking read-operations are permanently unblocked and a current read-thread also interrupted.
+++
Passed test_bytestream01 and test_iostream01
while causing full CPU load via `stress --cpu $(getconf _NPROCESSORS_ONLN)`.
|
|
|
|
| |
jau::io::consume_data_curl2 consider putBlocking result and call header_sync.notify_complete() after content_length setting
|
|
|
|
|
|
|
| |
- Drop 'std::move' for trivially copyable things
- Use 'const T&' if not moved into and used as R value only
- Notable: Can also hold a default value!
- Use non-const local vars, if used as return or move value
|
|
|
|
| |
buffer.recapacity() as it may throw and is not described in API
|
|
|
|
| |
scripts/build.sh), simple lint fixes.
|
|
|
|
| |
default implementation (ctor, dtor, ..), ..
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
header is complete (or an error occured, i.e. past header streaming stage)
`url_header_sync` allows user to wait until the url streamed header is completed, either
- Final (http) CRLF message received
- Any http header error response received
- First data package received
- End of operation
This way content_size can be awaited and acted accordingly at read,
e.g. a blocking read w/ content_size.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
super iostate_func class for std::basic_ios's iostate functionality
The burden of having a compile time header dependency to ByteInStream is too high
and may cause 'confusion' if linking unit w/ different settings - to say the very least!
In case Botan::DataSource is required, user shall wrap ByteInStream into such desired types.
+++
Don't include any iostream header.
std::basic_ios's iostate functionality allows us to reuse the std spec for our streaming classes,
enforcing a well specified iostate to be defined either by just setting the iostate
at read() for non-async sources like file or
by dynamical evaluation via rdstate() override for async sources.
Use shorter method names, eg check_available() -> available()
and iostream affine names, eg bytes_read() -> tellg().
Use 'void*' buffer types for read() and peak(), similar to POSIX,
removing the burden for a nonsense cast.
Drop ByteInStream_istream.
|
|
|
|
| |
`is_final=true` once at the end, even if input stream has zero size
|
|
|
|
| |
binary; Java: Add dirfd and fd ctor variants
|
|
|
|
|
|
|
| |
consumer_fn() call gets is_final set if next buffer has eof() w/ zero bytes.
This behavior is required for certain operations, i.e. where we cannot have a zero-sized consumer_fn() call as is_final=true.
Example: cipherpack using Botan API, where AEAD::finish() requires the last Tag bytes to be delivered.
|
|
|
|
| |
bytes are available, ensuring user notification
|
|
|
|
| |
''org.jau.nio.UriTk'; C++: 'jau::io::uri' -> 'jau::io::uri_tk'
|
|
|
|
| |
dependencies w/o using it
|
|
|
|
| |
contained and include the low level declarations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sourced as file or via remote URL
* `string_util.hpp`: Add `jau::to_string()` support for `std::string` and `std::string_view` as well as for `std::vector<T>` lists
* Add namespace `jau::io::uri`, limited URI scheme functionality to query whether implementation may handle the protocol.
- Query *libcurl* supported protocols at runtime
- Test for local file protocol
- Test whether protocol in given uri is supported by *libcurl*
* `jau::io::read_url_stream()`, sync and async, return immediately if protocol in given url is not supportet
- async variant returns `std::unique_ptr<std::thread>`, where a nullptr is used for no support
* `jau::io::ByteInStream_File` recognizes the local file protocol and cuts off `file://` is used.
- Fix: Recognition of a non-existing path, unaccessbile path or non-file case properly
* `jau::io::ByteInStream_URL` recognizes a non supported protocol via async `jau::io::read_url_stream()`.
* Added convenient `jau::io::std::unique_ptr<ByteInStream> to_ByteInStream()`
- Returning either a `jau::io::ByteInStream_File`, `jau::io::ByteInStream_URL` or nullptr if `path_or_url` is not supported
* Make Java class `org.jau.ney.Uri` standalone, drop dependencies for easier reusage.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
w/ response_code for errors >= 400 and buffer.interruptReader()
- curl replies -1 for unknown content_length
- also consume the curl header to detect response_code errors >= 400 (404 not found)
- in case of an error, we need to interrupt the ringbuffer-reader thread -> buffer.interruptReader(),
otherwise the thread would be blocked until timeout and renders application to not be responsive.
- interruptReader() has been added for the synchronous- and asynchronous read_url_stream() functions
- interruptReader() has been exposed as ByteInStream_Feed::interruptReader()
and added to ByteInStream_Feed::set_eof().
- the above is tested via test_iostream01 for synchronous- and asynchronous read_url_stream() functions
using a non-existing URL entity
- the above is tested via test_bytestream01 for ByteInStream_URL using a non-existing URL entity
and for and ByteInStream_Feed having the feeder thread prematurely end transmission.
|
|
|
|
| |
all methods noexcept, see Botan related notes; Add test_bytestream01 unit tests.
|
|
|
|
| |
exception on consumer_fn call
|
| |
|
|
project for better encapsulation, test and generic use
Fixed: ByteStream_File::check_available(): 'm_bytes_consumed - m_content_size >= n',
missed subtracting m_content_size (duh)
test_iostream01 uses the fragile std::system() call to start/stop mini_httpd as the http server for testing
streaming with curl.
|