firebase::storage::Storage

#include <storage.h>

Entry point for the Firebase C++ SDK for Cloud Storage.

Summary

To use the SDK, call firebase::storage::Storage::GetInstance() to obtain an instance of Storage, then use GetReference() to obtain references to child blobs. From there you can upload data with StorageReference::PutStream(), get data via StorageReference::GetStream().

Constructors and Destructors

~Storage()
Destructor.

Public functions

GetReference() const
Get a StorageReference to the root of the database.
GetReference(const char *path) const
Get a StorageReference for the specified path.
GetReference(const std::string & path) const
Get a StorageReference for the specified path.
GetReferenceFromUrl(const char *url) const
Get a StorageReference for the provided URL.
GetReferenceFromUrl(const std::string & url) const
Get a StorageReference for the provided URL.
app()
Get the firease::App that this Storage was created with.
max_download_retry_time()
double
Returns the maximum time in seconds to retry a download if a failure occurs.
max_operation_retry_time()
double
Returns the maximum time to retry operations other than upload and download if a failure occurs.
max_upload_retry_time()
double
Returns the maximum time to retry an upload if a failure occurs.
set_max_download_retry_time(double max_transfer_retry_seconds)
void
Sets the maximum time to retry a download if a failure occurs.
set_max_operation_retry_time(double max_transfer_retry_seconds)
void
Sets the maximum time to retry operations other than upload and download if a failure occurs.
set_max_upload_retry_time(double max_transfer_retry_seconds)
void
Sets the maximum time to retry an upload if a failure occurs.
url()
std::string
Get the URL that this Storage was created with.

Public static functions

GetInstance(::firebase::App *app, InitResult *init_result_out)
Get an instance of Storage corresponding to the given App.
GetInstance(::firebase::App *app, const char *url, InitResult *init_result_out)
Get an instance of Storage corresponding to the given App, with the given Cloud Storage URL.

Public functions

GetReference

StorageReference GetReference() const 

Get a StorageReference to the root of the database.

GetReference

StorageReference GetReference(
  const char *path
) const 

Get a StorageReference for the specified path.

GetReference

StorageReference GetReference(
  const std::string & path
) const 

Get a StorageReference for the specified path.

GetReferenceFromUrl

StorageReference GetReferenceFromUrl(
  const char *url
) const 

Get a StorageReference for the provided URL.

GetReferenceFromUrl

StorageReference GetReferenceFromUrl(
  const std::string & url
) const 

Get a StorageReference for the provided URL.

app

::firebase::App * app()

Get the firease::App that this Storage was created with.

Details
Returns
The firebase::App this Storage was created with.

max_download_retry_time

double max_download_retry_time()

Returns the maximum time in seconds to retry a download if a failure occurs.

max_operation_retry_time

double max_operation_retry_time()

Returns the maximum time to retry operations other than upload and download if a failure occurs.

max_upload_retry_time

double max_upload_retry_time()

Returns the maximum time to retry an upload if a failure occurs.

set_max_download_retry_time

void set_max_download_retry_time(
  double max_transfer_retry_seconds
)

Sets the maximum time to retry a download if a failure occurs.

Defaults to 600 seconds (10 minutes).

set_max_operation_retry_time

void set_max_operation_retry_time(
  double max_transfer_retry_seconds
)

Sets the maximum time to retry operations other than upload and download if a failure occurs.

Defaults to 120 seconds (2 minutes).

set_max_upload_retry_time

void set_max_upload_retry_time(
  double max_transfer_retry_seconds
)

Sets the maximum time to retry an upload if a failure occurs.

Defaults to 600 seconds (10 minutes).

url

std::string url()

Get the URL that this Storage was created with.

Details
Returns
The URL this Storage was created with, or an empty string if this Storage was created with default parameters.

~Storage

 ~Storage()

Destructor.

You may delete an instance of Storage when you are finished using it, to shut down the Storage library.

Public static functions

GetInstance

Storage * GetInstance(
  ::firebase::App *app,
  InitResult *init_result_out
)

Get an instance of Storage corresponding to the given App.

Cloud Storage uses firebase::App to communicate with Firebase Authentication to authenticate users to the server backend.

Details
Parameters
app
An instance of firebase::App. Cloud Storage will use this to communicate with Firebase Authentication.
init_result_out
Optional: If provided, write the init result here. Will be set to kInitResultSuccess if initialization succeeded, or kInitResultFailedMissingDependency on Android if Google Play services is not available on the current device.
Returns
An instance of Storage corresponding to the given App.

GetInstance

Storage * GetInstance(
  ::firebase::App *app,
  const char *url,
  InitResult *init_result_out
)

Get an instance of Storage corresponding to the given App, with the given Cloud Storage URL.

Cloud Storage uses firebase::App to communicate with Firebase Authentication to authenticate users to the server backend.

Details
Parameters
app
An instance of firebase::App. Cloud Storage will use this to communicate with Firebase Authentication.
url
Cloud Storage URL.
init_result_out
Optional: If provided, write the init result here. Will be set to kInitResultSuccess if initialization succeeded, or kInitResultFailedMissingDependency on Android if Google Play services is not available on the current device.
Returns
An instance of Storage corresponding to the given App.