Class ReadPayload (3.13.0-rc)

A partial or full response to an asynchronous download.

Constructors

ReadPayload()

ReadPayload(std::string)

Constructor from string. Applications may use this in their mocks.

Parameter
Name Description
contents std::string

ReadPayload(std::vector< std::string >)

Constructor from vector of strings.

Applications may use this in their mocks with more complex contents() results.

Parameter
Name Description
contents std::vector< std::string >

Functions

cord_contents() const &

The payload contents as an absl::Cord.

Copying an absl::Cord is relatively cheap, as the underlying buffers are reference counted and shared between copies. Applications that need to retain the payload data beyond the lifetime of this object can copy (or move) the returned value instead of copying the data in contents().

Retaining a copy of this value keeps the underlying buffers alive, but it does not extend the lifetime of any other resources (such as the RPC that received the data).

Returns
Type Description
absl::Cord const &

cord_contents() &&

The payload contents as an absl::Cord.

Copying an absl::Cord is relatively cheap, as the underlying buffers are reference counted and shared between copies. Applications that need to retain the payload data beyond the lifetime of this object can copy (or move) the returned value instead of copying the data in contents().

Retaining a copy of this value keeps the underlying buffers alive, but it does not extend the lifetime of any other resources (such as the RPC that received the data).

Returns
Type Description
absl::Cord

set_metadata(google::storage::v2::Object) &

Modifiers. Applications may need these in mocks.

Parameter
Name Description
v google::storage::v2::Object
Returns
Type Description
ReadPayload &

set_metadata(google::storage::v2::Object) &&

Modifiers. Applications may need these in mocks.

Parameter
Name Description
v google::storage::v2::Object
Returns
Type Description
ReadPayload &&

reset_metadata() &

Modifiers. Applications may need these in mocks.

Returns
Type Description
ReadPayload &

reset_metadata() &&

Modifiers. Applications may need these in mocks.

Returns
Type Description
ReadPayload &&

set_headers(storage::HeadersMap) &

Modifiers. Applications may need these in mocks.

Parameter
Name Description
v storage::HeadersMap
Returns
Type Description
ReadPayload &

set_headers(storage::HeadersMap) &&

Modifiers. Applications may need these in mocks.

Parameter
Name Description
v storage::HeadersMap
Returns
Type Description
ReadPayload &&

clear_headers() &

Modifiers. Applications may need these in mocks.

Returns
Type Description
ReadPayload &

clear_headers() &&

Modifiers. Applications may need these in mocks.

Returns
Type Description
ReadPayload &&

set_offset(std::int64_t) &

Modifiers. Applications may need these in mocks.

Parameter
Name Description
v std::int64_t
Returns
Type Description
ReadPayload &

set_offset(std::int64_t) &&

Modifiers. Applications may need these in mocks.

Parameter
Name Description
v std::int64_t
Returns
Type Description
ReadPayload &&

size() const

The total size of the payload.

Returns
Type Description
std::size_t

contents() const

The payload contents.

These buffers are invalidated if this object is modified.

Returns
Type Description
std::vector< absl::string_view >

metadata() const

The object metadata.

Returns
Type Description
std::optional< google::storage::v2::Object >

offset() const

The starting offset of the current message.

Returns
Type Description
std::int64_t

headers() const

The headers (if any) returned by the service.

For debugging only.

Returns
Type Description
storage::HeadersMap const &