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.
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).
See also
DataQuery.entitySet,deleteDownloadQuery,getDownloadQuery,getDownloadQueries,OfflineDataService.downloadQueriesCanOverlap,OfflineDataService.noDefaultEntityDownload,OfflineDataService.noDefaultStreamDownload.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.
-
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. -
Determine if this provider has detected metadata changes (during a previous download) that require re-downloading of previously downloaded entity sets. For example, if an additional property has been added to an entity type, and the relevent data needs to be re-downloaded to obtain values for the added property. Note: When metadata changes, the changes might not take full effect until an application restart.
Declaration
Swift
func hasMetadataChanges() throws -> BoolReturn Value
trueif this provider has detected metadata changes. -
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. -
Load previously saved download time estimates from
file.Declaration
Swift
func loadTimeEstimates(file: String, mustExist: Bool) throwsParameters
fileTime estimates file.
mustExistSpecify
trueif the file must exist. Existing in-memory time estimates remain unchanged if this parameter isfalseand the file does not exist. -
Metadata change listener. When metadata changes, the changes might not take full effect until an application restart. It is therefore advisable to restart the application process when the metadata has changed.
Declaration
Swift
var metadataListener: MetadataListener? { get set } -
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).
-
Progress listener for
downloadandupload.Declaration
Swift
var progressListener: ProgressListener? { get set } -
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.
-
Save download time estimates to
file. Should be called after a download operation.Declaration
Swift
func saveTimeEstimates(file: String) throwsParameters
fileTime estimates file.
-
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.