ObjectBox C and C++ API 4.3.0
 
Loading...
Searching...
No Matches
obx::Sync Class Reference

ObjectBox Sync makes data available on other devices. Start building a sync client using client() and connect to a remote server. More...

#include <objectbox-sync.hpp>

Static Public Member Functions

static bool isAvailable ()
 
static std::shared_ptr< SyncClientclient (Store &store, const std::string &serverUrl, const SyncCredentials &creds)
 Creates a sync client associated with the given store and configures it with the given options. This does not initiate any connection attempts yet: call SyncClient::start() to do so. Before start(), you can still configure some aspects of the sync client, e.g. its "request update" mode.
 
static std::shared_ptr< SyncClientclient (Store &store, OBX_sync *cSync)
 Adopts an existing OBX_sync* sync client, taking ownership of the pointer.
 

Detailed Description

ObjectBox Sync makes data available on other devices. Start building a sync client using client() and connect to a remote server.

Member Function Documentation

◆ client() [1/2]

static std::shared_ptr< SyncClient > obx::Sync::client ( Store store,
const std::string &  serverUrl,
const SyncCredentials creds 
)
inlinestatic

Creates a sync client associated with the given store and configures it with the given options. This does not initiate any connection attempts yet: call SyncClient::start() to do so. Before start(), you can still configure some aspects of the sync client, e.g. its "request update" mode.

Note
While you may not interact with SyncClient directly after start(), you need to hold on to the object. Make sure the SyncClient is not destroyed and thus synchronization can keep running in the background.

◆ client() [2/2]

static std::shared_ptr< SyncClient > obx::Sync::client ( Store store,
OBX_sync cSync 
)
inlinestatic

Adopts an existing OBX_sync* sync client, taking ownership of the pointer.

Parameters
cSyncan initialized sync client. You must NOT call obx_sync_close() yourself anymore.

◆ isAvailable()

static bool obx::Sync::isAvailable ( )
inlinestatic