firebase::firestore::Settings

#include <settings.h>

Settings used to configure aFirestore instance.

Summary

Constructors and Destructors

Settings()
Creates the default settings.
Settings(constSettings & other)
Copy constructor.
Settings(Settings && other)
Move constructor.

Public static attributes

kCacheSizeUnlimited = -1
constexpr int64_t
Constant to use withset_cache_size_bytes to disable garbage collection.

Friend classes

operator<<
friend std::ostream &
Outputs the string representation of theseSettings to the given stream.

Public functions

ToString() const
std::string
Returns a string representation of theseSettings for logging/debugging purposes.
cache_size_bytes() const
int64_t
Returns cache size for on-disk data.
dispatch_queue() const
dispatch_queue_t
Returns a dispatch queue thatFirestore will use to execute callbacks.
host() const
const std::string &
Gets the host of theFirestore backend to connect to.
is_persistence_enabled() const
bool
Returns whether to enable local persistent storage.
is_ssl_enabled() const
bool
Returns whether to use SSL when communicating.
operator=(constSettings & other)=default
Copy assignment operator.
operator=(Settings && other)=default
Move assignment operator.
set_cache_size_bytes(int64_t value)
void
Sets an approximate cache size threshold for the on-disk data.
set_dispatch_queue(dispatch_queue_t queue)
void
Sets the dispatch queue thatFirestore will use to execute callbacks.
set_host(std::string host)
void
Sets the host of theFirestore backend.
set_persistence_enabled(bool enabled)
void
Enables or disables local persistent storage.
set_ssl_enabled(bool enabled)
void
Enables or disables SSL for communication.

Public static attributes

kCacheSizeUnlimited

constexprint64_tkCacheSizeUnlimited=-1

Constant to use withset_cache_size_bytes to disable garbage collection.

Friend classes

operator<<

friendstd::ostream&operator<<(std::ostream&out,constSettings&settings)

Outputs the string representation of theseSettings to the given stream.

See also:ToString() for comments on the representation format.

Public functions

Settings

Settings()

Creates the default settings.

Settings

Settings(constSettings&other)=default

Copy constructor.

This performs a deep copy, creating an independent instance.

Details
Parameters
other
Settings to copy from.

Settings

Settings(Settings&&other)=default

Move constructor.

Moving is more efficient than copying forSettings. After being moved from,Settings is in a valid but unspecified state.

Details
Parameters
other
Settings to move data from.

ToString

std::stringToString()const

dispatch_queue

dispatch_queue_tdispatch_queue()const

Returns a dispatch queue thatFirestore will use to execute callbacks.

The returned dispatch queue is used for all completion handlers and event handlers.

If no dispatch queue is explictly set by callingset_dispatch_queue() then a dedicated "callback queue" will be used; namely, the main thread will not be used for callbacks unless expliclty set to do so by a call toset_dispatch_queue().

Note: This method is only available when__OBJC__ is defined, such as when compiling for iOS or tvOS.See also:set_dispatch_queue(dispatch_queue_t) for information on how to explicitly set the dispatch queue to use.

host

conststd::string&host()const

Gets the host of theFirestore backend to connect to.

is_persistence_enabled

boolis_persistence_enabled()const

Returns whether to enable local persistent storage.

is_ssl_enabled

boolis_ssl_enabled()const

Returns whether to use SSL when communicating.

operator=

Settings&operator=(constSettings&other)=default

Copy assignment operator.

This performs a deep copy, creating an independent instance.

Details
Parameters
other
Settings to copy from.
Returns
Reference to the destinationSettings.

operator=

Settings&operator=(Settings&&other)=default

Move assignment operator.

Moving is more efficient than copying forSettings. After being moved from,Settings is in a valid but unspecified state.

Details
Parameters
other
Settings to move data from.
Returns
Reference to the destinationSettings.

set_cache_size_bytes

voidset_cache_size_bytes(int64_tvalue)

Sets an approximate cache size threshold for the on-disk data.

If the cache grows beyond this size, CloudFirestore will start removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size, only that if the cache exceeds the given size, cleanup will be attempted.

By default, collection is enabled with a cache size of 100 MB. The minimum value is 1 MB.

set_dispatch_queue

voidset_dispatch_queue(dispatch_queue_tqueue)

Sets the dispatch queue thatFirestore will use to execute callbacks.

The specified dispatch queue will be used for all completion handlers and event handlers.

Note: This method is only available when__OBJC__ is defined, such as when compiling for iOS or tvOS.See also:dispatch_queue() for the "get" counterpart to this method.

Details
Parameters
queue
The dispatch queue to use.

set_host

voidset_host(std::stringhost)

Sets the host of theFirestore backend.

The default is "firestore.googleapis.com".

Details
Parameters
host
The host string.

set_persistence_enabled

voidset_persistence_enabled(boolenabled)

Enables or disables local persistent storage.

Details
Parameters
enabled
Set true to enable local persistent storage.

set_ssl_enabled

voidset_ssl_enabled(boolenabled)

Enables or disables SSL for communication.

Details
Parameters
enabled
Set true to enable SSL for communication.

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.