Google Cloud Storage C++ Client
1.42.0
A C++ Client Library for Google Cloud Storage
|
Defines a std::basic_istream<char>
to read from a GCS Object.
More...
#include <google/cloud/storage/object_read_stream.h>
Public Member Functions | |
ObjectReadStream () | |
Creates a stream not associated with any buffer. More... | |
ObjectReadStream (std::unique_ptr< internal::ObjectReadStreambuf > buf) | |
Creates a stream associated with the given streambuf . More... | |
ObjectReadStream (ObjectReadStream &&rhs) noexcept | |
ObjectReadStream & | operator= (ObjectReadStream &&rhs) noexcept |
void | swap (ObjectReadStream &rhs) |
ObjectReadStream (ObjectReadStream const &)=delete | |
ObjectReadStream & | operator= (ObjectReadStream const &)=delete |
~ObjectReadStream () override | |
Closes the stream (if necessary). More... | |
bool | IsOpen () const |
void | Close () |
Terminate the download, possibly before completing it. More... | |
Status const & | status () const & |
Report any download errors. More... | |
std::string const & | received_hash () const |
The received CRC32C checksum and the MD5 hash values as reported by GCS. More... | |
std::string const & | computed_hash () const |
The locally computed checksum and hashes, as a string. More... | |
HeadersMap const & | headers () const |
The headers (if any) returned by the service. More... | |
Object metadata information. | |
When downloading an object a limited amount of information about the object's metadata is returned as part of the download. Some of this information is important for applications performing multiple downloads (maybe of different ranges) of the same object. Such applications may want to use the generation number to guarantee all the downloads are actually referencing the same object. One could do this by first querying the metadata before the first download, but this is less efficient as it requires one additional server round trip. Note that all these attributes are | |
absl::optional< std::int64_t > const & | generation () const |
The object's generation at the time of the download, if known. More... | |
absl::optional< std::int64_t > const & | metageneration () const |
The object's metageneration at the time of the download, if known. More... | |
absl::optional< std::string > const & | storage_class () const |
The object's storage class at the time of the download, if known. More... | |
absl::optional< std::uint64_t > const & | size () const |
The object's size at the time of the download, if known. More... | |
Defines a std::basic_istream<char>
to read from a GCS Object.
Definition at line 33 of file object_read_stream.h.
google::cloud::storage::ObjectReadStream::ObjectReadStream | ( | ) |
Creates a stream not associated with any buffer.
Attempts to use this stream will result in failures.
|
inlineexplicit |
Creates a stream associated with the given streambuf
.
Definition at line 45 of file object_read_stream.h.
|
noexcept |
|
delete |
|
override |
Closes the stream (if necessary).
void google::cloud::storage::ObjectReadStream::Close | ( | ) |
Terminate the download, possibly before completing it.
|
inline |
The locally computed checksum and hashes, as a string.
This object computes the CRC32C checksum and MD5 hash of the downloaded data. Note that there are several cases where these values may be empty or irrelevant, for example:
The string has the same format as the value returned by received_hash()
. Note that the format of this string is also subject to change without notice.
Definition at line 121 of file object_read_stream.h.
|
inline |
The object's generation at the time of the download, if known.
Definition at line 156 of file object_read_stream.h.
|
inline |
The headers (if any) returned by the service.
For debugging only.
Definition at line 135 of file object_read_stream.h.
|
inline |
Definition at line 72 of file object_read_stream.h.
|
inline |
The object's metageneration at the time of the download, if known.
Definition at line 161 of file object_read_stream.h.
|
inlinenoexcept |
Definition at line 53 of file object_read_stream.h.
|
delete |
|
inline |
The received CRC32C checksum and the MD5 hash values as reported by GCS.
When the download is finalized (via Close()
or the end of file) the GCS server reports the CRC32C checksum and, except for composite objects, the MD5 hash of the data. This class compares the locally computed and received hashes so applications can detect data download errors.
The values are reported as comma separated tag=value
pairs, e.g. crc32c=AAAAAA==,md5=1B2M2Y8AsgTpgAmY7PhCfg==
. The format of this string is subject to change without notice, they are provided for informational purposes only.
Definition at line 102 of file object_read_stream.h.
|
inline |
The object's size at the time of the download, if known.
If you are using object transcoding this represents the stored size of the object, the number of downloaded bytes (after decompression) may be larger.
Definition at line 179 of file object_read_stream.h.
|
inline |
Report any download errors.
Note that errors may go undetected until the download completes.
Definition at line 84 of file object_read_stream.h.
|
inline |
The object's storage class at the time of the download, if known.
Definition at line 166 of file object_read_stream.h.
|
inline |
Definition at line 59 of file object_read_stream.h.