firebase::storage::Metadata

#include <metadata.h>

Metadata stores default attributes such as size and content type.

Summary

Metadata for aStorageReference. You may also store custom metadata key value pairs.Metadata values may be used to authorize operations using declarative validation rules.

Constructors and Destructors

Metadata()
Create a defaultMetadata that you can modify and use.
Metadata(constMetadata & other)
Copy constructor.
Metadata(Metadata && other)
Move constructor.
~Metadata()

Public functions

GetReference() const
Return the associatedStorageReference to which thisMetadata belongs.
bucket() const
const char *
Return the owning Google CloudStorage bucket for theStorageReference.
cache_control() const
const char *
Return the Cache Control setting of theStorageReference.
content_disposition() const
const char *
Return the content disposition of theStorageReference.
content_encoding() const
const char *
Return the content encoding for theStorageReference.
content_language() const
const char *
Return the content language for theStorageReference.
content_type() const
const char *
Return the content type of theStorageReference.
creation_time() const
int64_t
Return the time theStorageReference was created in milliseconds since the epoch.
custom_metadata() const
std::map< std::string, std::string > *
Return a map of custom metadata key value pairs.
generation() const
int64_t
Return a version String indicating what version of theStorageReference.
is_valid() const
bool
Returns true if thisMetadata is valid, false if it is not valid.
md5_hash() const
const char *
MD5 hash of the data; encoded using base64.
metadata_generation() const
int64_t
Return a version String indicating the version of this StorageMetadata.
name() const
const char *
Return a simple name of theStorageReference object.
operator=(constMetadata & other)
Copy assignment operator.
operator=(Metadata && other)
Move assignment operator.
path() const
const char *
Return the path of theStorageReference object.
set_cache_control(const char *cache_control)
void
Set the Cache Control setting of theStorageReference.
set_cache_control(const std::string & cache_control)
void
Set the Cache Control setting of theStorageReference.
set_content_disposition(const char *disposition)
void
Set the content disposition of theStorageReference.
set_content_disposition(const std::string & disposition)
void
Set the content disposition of theStorageReference.
set_content_encoding(const char *encoding)
void
Set the content encoding for theStorageReference.
set_content_encoding(const std::string & encoding)
void
Set the content encoding for theStorageReference.
set_content_language(const char *language)
void
Set the content language for theStorageReference.
set_content_language(const std::string & language)
void
Set the content language for theStorageReference.
set_content_type(const char *type)
void
Set the content type of theStorageReference.
set_content_type(const std::string & type)
void
Set the content type of theStorageReference.
size_bytes() const
int64_t
Return the stored Size in bytes of theStorageReference object.
updated_time() const
int64_t
Return the time theStorageReference was last updated in milliseconds since the epoch.

Public functions

GetReference

StorageReferenceGetReference()const

Return the associatedStorageReference to which thisMetadata belongs.

Details
Returns
The associatedStorageReference to which thisMetadata belongs. If thisMetadata is invalid or is not associated with any file, an invalidStorageReference is returned.

Metadata

Metadata()

Create a defaultMetadata that you can modify and use.

Metadata

Metadata(constMetadata&other)

Copy constructor.

Details
Parameters
other
Metadata to copy from.

Metadata

Metadata(Metadata&&other)

Move constructor.

Moving is an efficient operation forMetadata.

Details
Parameters
other
Metadata to move from.

bucket

constchar*bucket()const

Return the owning Google CloudStorage bucket for theStorageReference.

Details
Returns
The owning Google CloudStorage bucket for theStorageReference.

cache_control

constchar*cache_control()const

Return the Cache Control setting of theStorageReference.

See also:https://tools.ietf.org/html/rfc7234#section-5.2

Details
Returns
The Cache Control setting of theStorageReference.

content_disposition

constchar*content_disposition()const

Return the content disposition of theStorageReference.

See also:https://tools.ietf.org/html/rfc6266

Details
Returns
The content disposition of theStorageReference.

content_encoding

constchar*content_encoding()const

Return the content encoding for theStorageReference.

See also:https://tools.ietf.org/html/rfc2616#section-14.11

Details
Returns
The content encoding for theStorageReference.

content_language

constchar*content_language()const

Return the content language for theStorageReference.

See also:https://tools.ietf.org/html/rfc2616#section-14.12

Details
Returns
The content language for theStorageReference.

content_type

constchar*content_type()const

Return the content type of theStorageReference.

See also:https://tools.ietf.org/html/rfc2616#section-14.17

Details
Returns
The content type of theStorageReference.

creation_time

int64_tcreation_time()const

Return the time theStorageReference was created in milliseconds since the epoch.

Details
Returns
The time theStorageReference was created in milliseconds since the epoch.

custom_metadata

std::map<std::string,std::string>*custom_metadata()const

Return a map of custom metadata key value pairs.

The pointer returned is only valid during the lifetime of theMetadata object that owns it.

Details
Returns
The keys for custom metadata.

generation

int64_tgeneration()const

Return a version String indicating what version of theStorageReference.

Details
Returns
A value indicating the version of theStorageReference.

is_valid

boolis_valid()const

Returns true if thisMetadata is valid, false if it is not valid.

An invalidMetadata is returned when a method such asStorageReference::GetMetadata() completes with an error.

Details
Returns
true if thisMetadata is valid, false if thisMetadata is invalid.

md5_hash

constchar*md5_hash()const

MD5 hash of the data; encoded using base64.

Details
Returns
MD5 hash of the data; encoded using base64.

metadata_generation

int64_tmetadata_generation()const

Return a version String indicating the version of this StorageMetadata.

Details
Returns
A value indicating the version of this StorageMetadata.

name

constchar*name()const

Return a simple name of theStorageReference object.

Details
Returns
A simple name of theStorageReference object.

operator=

Metadata&operator=(constMetadata&other)

Copy assignment operator.

Details
Parameters
other
Metadata to copy from.
Returns
Reference to the destinationMetadata.

operator=

Metadata&operator=(Metadata&&other)

Move assignment operator.

Moving is an efficient operation forMetadata.

Details
Parameters
other
Metadata to move from.
Returns
Reference to the destinationMetadata.

path

constchar*path()const

Return the path of theStorageReference object.

Details
Returns
The path of theStorageReference object.

set_cache_control

voidset_cache_control(constchar*cache_control)

Set the Cache Control setting of theStorageReference.

See also:https://tools.ietf.org/html/rfc7234#section-5.2

set_cache_control

voidset_cache_control(conststd::string&cache_control)

Set the Cache Control setting of theStorageReference.

See also:https://tools.ietf.org/html/rfc7234#section-5.2

set_content_disposition

voidset_content_disposition(constchar*disposition)

Set the content disposition of theStorageReference.

See also:https://tools.ietf.org/html/rfc6266

set_content_disposition

voidset_content_disposition(conststd::string&disposition)

Set the content disposition of theStorageReference.

See also:https://tools.ietf.org/html/rfc6266

set_content_encoding

voidset_content_encoding(constchar*encoding)

set_content_encoding

voidset_content_encoding(conststd::string&encoding)

set_content_language

voidset_content_language(constchar*language)

set_content_language

voidset_content_language(conststd::string&language)

Set the content language for theStorageReference.

This must be an ISO 639-1 two-letter language code. E.g. "zh", "es", "en".

See also:https://www.loc.gov/standards/iso639-2/php/code_list.php

set_content_type

voidset_content_type(constchar*type)

set_content_type

voidset_content_type(conststd::string&type)

size_bytes

int64_tsize_bytes()const

Return the stored Size in bytes of theStorageReference object.

Details
Returns
The stored Size in bytes of theStorageReference object.

updated_time

int64_tupdated_time()const

Return the time theStorageReference was last updated in milliseconds since the epoch.

Details
Returns
The time theStorageReference was last updated in milliseconds since the epoch.

~Metadata

~Metadata()

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-23 UTC.