DataSyncProvider
public protocol DataSyncProvider : DataServiceProvider
A provider interface for data services which can synchronize data between a local database and a backend system.
-
Cancel any download(s) that are currently in progress.
See also
download.Declaration
Swift
func cancelDownload() throws -
Cancel the specifed pending requests. The requests should be cancelled as a batch, which might perform better than calling
PendingRequest.cancelone request at a time.See also
getQueuedRequests,getFailedRequests.Declaration
Swift
func cancelPendingRequests(_ requests: PendingRequestList?) throwsParameters
requestsPending requests to be cancelled. If null, then all pending requests will be cancelled. If empty, then no pending requests will be cancelled.
-
Cancel any upload(s) that are currently in progress.
See also
upload.Declaration
Swift
func cancelUpload() throws -
Clear this provider. This will
closethe local database, and then delete the database file(s). If the application has other active threads which may try to use the database while it is being cleared, the deletion of the database file(s) might fail.Declaration
Swift
func clear() throws -
Close this provider. This will close any connection to the local database held by the current thread. If the application has other active threads which may try to use the database while it is being closed, it might remain open after this call has completed.
Declaration
Swift
func close() throws -
Create a persistent query to specify criteria for downloading entities for an entity set. This query is persisted across application restarts. Multiple download queries can be defined for the same entity set (e.g. with different filters).
Declaration
Swift
func createDownloadQuery(name: String, query: DataQuery, streams: Bool) throwsParameters
nameQuery name. Must be unique.
queryData query. Use
DataQuery.fromto specify the query’s entity set.streamsIf
true, then enable downloading of associated streams. -
Delete a persistent query previously created by
createDownloadQuery, along with any previously downloaded associated entities. Note: if there is a large number of previously downloaded associated entities, deletion of the download query might be time-consuming.Declaration
Swift
func deleteDownloadQuery(name: String) throwsParameters
nameQuery name.
-
Download backend data changes into the local database.
Declaration
Swift
func download(groups: StringList, options: SyncOptions) throwsParameters
groupsIf null or empty, then data will be downloaded from all entity sets. If non-empty, then it specifies groups to be downloaded.
optionsDownload options, including cancellation token and progress listener.
-
Return a named download group; the group is created if it doesn’t exist already.
Declaration
Swift
func downloadGroup(_ group: String) -> DownloadGroupParameters
groupName of download group.
Return Value
A download group.
-
Retrieve all of the persistent queries previously created by
createDownloadQueryfor a specified entity set.Declaration
Swift
func downloadQueries(from: EntitySet?) throws -> DownloadQueryListParameters
fromEntity set. If not specified, then download queries for all entity sets are returned.
Return Value
List of matching queries.
-
Retrieve a persistent query previously created by
createDownloadQuery.Declaration
Swift
func downloadQuery(name: String) throws -> DownloadQuery?Parameters
nameQuery name.
Return Value
The download query, or
nilif no query exists with the specified name. -
Declaration
Swift
func eventHistory(matching query: DataQuery?) throws -> SyncEventListParameters
queryIf specified, then
DataQuery.queryFilterwill be used for event filtering andDataQuery.sortItemswill be used for result ordering. If not specified (or null), all synchronization events will be returned.Return Value
a list of the synchronization events since the local database was created.
-
Declaration
Swift
func failedRequests(matching query: DataQuery?, headers: HTTPHeaders?, options: RequestOptions?) throws -> PendingRequestListParameters
queryIf specified, then
DataQuery.entitySetandDataQuery.queryFilterwill be used for request filtering andDataQuery.sortItemswill be used for result ordering. If not specified (or null), all failed requests will be returned.headersIf specified, then the returned pending requests will be further filtered to include only those with matching headers.
optionsIf specified, then the returned pending requests will be further filtered to include only those with matching options (
RequestOptions.changeSet,RequestOptions.customTag,RequestOptions.uploadGroup).Return Value
List of failed requests.
-
Declaration
Swift
func hasFailedRequests(matching query: DataQuery?, headers: HTTPHeaders?, options: RequestOptions?) throws -> BoolParameters
queryIf specified, then
DataQuery.entitySetandDataQuery.queryFilterwill be used for request filtering.headersIf specified, then the returned pending requests will be further filtered to include only those with matching headers.
optionsIf specified, then the returned pending requests will be further filtered to include only those with matching options (
RequestOptions.changeSet,RequestOptions.customTag,RequestOptions.uploadGroup).Return Value
trueif there are any failed requests in the local database (matching thequery, if specified). -
Declaration
Swift
func hasInitialData() throws -> BoolReturn Value
trueif adownloadhas previously been successfully executed to obtain initial data for the local database. -
Declaration
Swift
func hasPendingDownload() throws -> BoolReturn Value
trueif adownloadis currently in progress or if the previous download did not terminate normally (i.e. it failed or was cancelled). -
Declaration
Swift
func hasPendingUpload() throws -> BoolReturn Value
trueif anuploadis currently in progress or if the previous upload did not terminate normally (i.e. it failed or was cancelled). -
Declaration
Swift
func hasQueuedRequests(matching query: DataQuery?, headers: HTTPHeaders?, options: RequestOptions?) throws -> BoolParameters
queryIf specified, then
DataQuery.entitySetandDataQuery.queryFilterwill be used for request filtering.headersIf specified, then the returned pending requests will be further filtered to include only those with matching headers.
optionsIf specified, then the returned pending requests will be further filtered to include only those with matching options (
RequestOptions.changeSet,RequestOptions.customTag,RequestOptions.uploadGroup).Return Value
trueif there are any queued requests in the local database (matching thequery, if specified). -
Declaration
Swift
func lastDownloadTime() throws -> GlobalDateTime?Return Value
Date and time for the last
downloadrequest. -
Declaration
Swift
func lastUploadTime() throws -> GlobalDateTime?Return Value
Date and time for the last
uploadrequest. -
Provider for online access to the backend system.
Declaration
Swift
var onlineProvider: OnlineODataProvider { get } -
For internal use by proxy services.
Declaration
Swift
var onlineSetup: Bool { get set } -
Open this provider. This will create the local database if it doesn’t exist already. This might also communicate with the backend system (but only the first time it is called, if metadata is not available locally).
Declaration
Swift
func open() throws -
Declaration
Swift
func previousUser() throws -> String?Return Value
the previous user of the local database (if any).
-
Declaration
Swift
func queuedRequests(matching query: DataQuery?, headers: HTTPHeaders?, options: RequestOptions?) throws -> PendingRequestListParameters
queryIf specified, then
DataQuery.entitySetandDataQuery.queryFilterwill be used for request filtering andDataQuery.sortItemswill be used for result ordering. If not specified (or null), all queued requests will be returned.headersIf specified, then the returned pending requests will be further filtered to include only those with matching headers.
optionsIf specified, then the returned pending requests will be further filtered to include only those with matching options (
RequestOptions.changeSet,RequestOptions.customTag,RequestOptions.uploadGroup).Return Value
List of queued requests.
-
Undo all pending (local) changes for
entities, so they will not be subsequently uploaded.Declaration
Swift
func undoPendingChanges(for entities: EntityValueList) throwsParameters
entitiesA list of entities whose pending changes will be undone.
-
Upload data changes for all uploadable entity sets.
Declaration
Swift
func upload(groups: StringList, options: SyncOptions) throwsParameters
groupsIf empty, then data will be uploaded from all entity sets. If non-empty, then it specifies groups to be included.
optionsUpload options, including cancellation token and progress listener.
-
Upload a copy of the local database file (or files) to the backend server (or an intermediary server) for diagnostic purposes. Note: if the local database is encrypted, and
encryptionKeyis null, this operation might fail (depending on the provider). Note: if the local database is not encrypted, andencryptionKeyis non-null, this operation might fail (depending on the provider).Declaration
Swift
func uploadDatabaseFile(encryptionKey: String?, note: String?, options: SyncOptions) throwsParameters
encryptionKeyEncryption key for the uploaded database, which may differ from the encryption key of the local database (if any).
noteAssociated note for trusted users who have access to uploaded databases for diagnostic purposes.
optionsUpload options, including cancellation token and progress listener.