firebase::firestore::Settings

#include <settings.h>

Settings used to configure a Firestore instance.

Summary

Constructors and Destructors

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

Public static attributes

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

Friend classes

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

Public functions

ToString() const
std::string
Returns a string representation of these Settings 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 that Firestore will use to execute callbacks.
host() const
const std::string &
Gets the host of the Firestore 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=(const Settings & 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 that Firestore will use to execute callbacks.
set_host(std::string host)
void
Sets the host of the Firestore 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

constexpr int64_t kCacheSizeUnlimited = -1

Constant to use with set_cache_size_bytes to disable garbage collection.

Friend classes

operator<<

friend std::ostream & operator<<(std::ostream &out, const Settings &settings)

Outputs the string representation of these Settings to the given stream.

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

Public functions

Settings

 Settings()

Creates the default settings.

Settings

 Settings(
  const Settings & 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 for Settings. After being moved from, Settings is in a valid but unspecified state.

Details
Parameters
other
Settings to move data from.

ToString

std::string ToString() const 

Returns a string representation of these Settings for logging/debugging purposes.

cache_size_bytes

int64_t cache_size_bytes() const 

Returns cache size for on-disk data.

dispatch_queue

dispatch_queue_t dispatch_queue() const 

Returns a dispatch queue that Firestore 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 calling set_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 to set_dispatch_queue().

See also:set_dispatch_queue(dispatch_queue_t) for information on how to explicitly set the dispatch queue to use.

host

const std::string & host() const 

Gets the host of the Firestore backend to connect to.

is_persistence_enabled

bool is_persistence_enabled() const 

Returns whether to enable local persistent storage.

is_ssl_enabled

bool is_ssl_enabled() const 

Returns whether to use SSL when communicating.

operator=

Settings & operator=(
  const Settings & 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 destination Settings.

operator=

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

Move assignment operator.

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

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

set_cache_size_bytes

void set_cache_size_bytes(
  int64_t value
)

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

If the cache grows beyond this size, Cloud Firestore 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

void set_dispatch_queue(
  dispatch_queue_t queue
)

Sets the dispatch queue that Firestore will use to execute callbacks.

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

See also:dispatch_queue() for the "get" counterpart to this method.

Details
Parameters
queue
The dispatch queue to use.

set_host

void set_host(
  std::string host
)

Sets the host of the Firestore backend.

The default is "firestore.googleapis.com".

Details
Parameters
host
The host string.

set_persistence_enabled

void set_persistence_enabled(
  bool enabled
)

Enables or disables local persistent storage.

Details
Parameters
enabled
Set true to enable local persistent storage.

set_ssl_enabled

void set_ssl_enabled(
  bool enabled
)

Enables or disables SSL for communication.

Details
Parameters
enabled
Set true to enable SSL for communication.