OpenAB
1.0.1
|
Documentation for class SyncMetadata. This class is designed to store and keep track of synchronization metadata information. More...
#include <Sync.hpp>
Public Types | |
enum | SyncMetadataState { NotPresent = 0, NotChanged, Modified } |
Public Member Functions | |
SyncMetadata () | |
~SyncMetadata () | |
void | addItem (const std::string &remoteId, const std::string &remoteRevision, const std::string &localId, const std::string &localRevision) |
Adds new record to metadata. It will bind remote and local items, detected as identical. More... | |
void | removeItem (const std::string &remoteId, const std::string &localId) |
Removes record from metadata. It will remove information about remote and local items binding. More... | |
void | updateRemoteRevision (const std::string &uid, const std::string &revision) |
Updates revision of remote item. More... | |
void | updateLocalRevision (const std::string &uid, const std::string &revision) |
Updates revision of local item. More... | |
std::string | getRemoteRevision (const std::string &uid) const |
Returns revision of remote item. More... | |
std::string | getLocalRevision (const std::string &uid) const |
Returns revision of local item. More... | |
bool | hasLocalId (const std::string &uid) const |
Checks if there is metadata information for local item with given id. More... | |
bool | hasRemoteId (const std::string &uid) const |
Checks if there is metadata information for remote item with given id. More... | |
std::string | toJSON () const |
Converts metadata into JSON format, so it can be passed around as string. More... | |
bool | fromJSON (const std::string &json) |
Load metadata from JSON format. More... | |
void | resetRemoteState (SyncMetadataState st) |
Resets state of all remote items. More... | |
void | resetLocalState (SyncMetadataState st) |
Resets state of all local items. More... | |
void | setRemoteState (const std::string &uid, SyncMetadataState state) |
Sets state of remote item. More... | |
void | setLocalState (const std::string &uid, SyncMetadataState state) |
Sets state of remote item. More... | |
std::map< std::string, std::string > | getItemsWithState (SyncMetadataState localState, SyncMetadataState remoteState) |
Queries all metadata record which items are in given states. More... | |
std::string | getLocalSyncToken () const |
Returns sync token of local storage after last synchronization. More... | |
void | setLocalSyncToken (const std::string &token) |
Sets sync token of local storage to be stored in metadata. More... | |
std::string | getRemoteSyncToken () const |
Returns sync token of remote storage after last synchronization. More... | |
void | setRemoteSyncToken (const std::string &token) |
Sets sync token of remote storage to be stored in metadata. More... | |
Documentation for class SyncMetadata. This class is designed to store and keep track of synchronization metadata information.
OpenAB_Sync::SyncMetadata::SyncMetadata | ( | ) |
OpenAB_Sync::SyncMetadata::~SyncMetadata | ( | ) |
void OpenAB_Sync::SyncMetadata::addItem | ( | const std::string & | remoteId, |
const std::string & | remoteRevision, | ||
const std::string & | localId, | ||
const std::string & | localRevision | ||
) |
Adds new record to metadata. It will bind remote and local items, detected as identical.
remoteId | id of remote item |
remoteRevision | revision of remote item |
localId | id of local item |
localRevision | revision of local item |
bool OpenAB_Sync::SyncMetadata::fromJSON | ( | const std::string & | json | ) |
Load metadata from JSON format.
json | json encoded metadata. |
std::map< std::string, std::string > OpenAB_Sync::SyncMetadata::getItemsWithState | ( | SyncMetadataState | localState, |
SyncMetadataState | remoteState | ||
) |
Queries all metadata record which items are in given states.
localState | state of local item |
remoteState | state of remote item |
std::string OpenAB_Sync::SyncMetadata::getLocalRevision | ( | const std::string & | uid | ) | const |
Returns revision of local item.
uid | id of local item. |
std::string OpenAB_Sync::SyncMetadata::getLocalSyncToken | ( | ) | const |
Returns sync token of local storage after last synchronization.
std::string OpenAB_Sync::SyncMetadata::getRemoteRevision | ( | const std::string & | uid | ) | const |
Returns revision of remote item.
uid | id of remote item. |
std::string OpenAB_Sync::SyncMetadata::getRemoteSyncToken | ( | ) | const |
Returns sync token of remote storage after last synchronization.
bool OpenAB_Sync::SyncMetadata::hasLocalId | ( | const std::string & | uid | ) | const |
Checks if there is metadata information for local item with given id.
uid | id of local item. |
bool OpenAB_Sync::SyncMetadata::hasRemoteId | ( | const std::string & | uid | ) | const |
Checks if there is metadata information for remote item with given id.
uid | if of remote item. |
void OpenAB_Sync::SyncMetadata::removeItem | ( | const std::string & | remoteId, |
const std::string & | localId | ||
) |
Removes record from metadata. It will remove information about remote and local items binding.
remoteId | id of remote item |
localId | id of local item |
void OpenAB_Sync::SyncMetadata::resetLocalState | ( | enum SyncMetadata::SyncMetadataState | state | ) |
Resets state of all local items.
[in] | st | state to be set for all local items. |
void OpenAB_Sync::SyncMetadata::resetRemoteState | ( | enum SyncMetadata::SyncMetadataState | state | ) |
Resets state of all remote items.
[in] | st | state to be set for all remote items. |
void OpenAB_Sync::SyncMetadata::setLocalState | ( | const std::string & | uid, |
SyncMetadata::SyncMetadataState | state | ||
) |
Sets state of remote item.
uid | id of remote item |
state | new state of item |
void OpenAB_Sync::SyncMetadata::setLocalSyncToken | ( | const std::string & | token | ) |
Sets sync token of local storage to be stored in metadata.
token | sync token to be set |
void OpenAB_Sync::SyncMetadata::setRemoteState | ( | const std::string & | uid, |
SyncMetadata::SyncMetadataState | state | ||
) |
Sets state of remote item.
uid | id of remote item |
state | new state of item |
void OpenAB_Sync::SyncMetadata::setRemoteSyncToken | ( | const std::string & | token | ) |
Sets sync token of remote storage to be stored in metadata.
token | sync token to be set |
std::string OpenAB_Sync::SyncMetadata::toJSON | ( | ) | const |
Converts metadata into JSON format, so it can be passed around as string.
void OpenAB_Sync::SyncMetadata::updateLocalRevision | ( | const std::string & | uid, |
const std::string & | revision | ||
) |
Updates revision of local item.
uid | id of local item |
revision | new revision of local item |
void OpenAB_Sync::SyncMetadata::updateRemoteRevision | ( | const std::string & | uid, |
const std::string & | revision | ||
) |
Updates revision of remote item.
uid | id of remote item |
revision | new revision of remote item |