Completely sync a database, pushing/pulling/merging/applying changes `database` - Database to sync `file` - File to sync with `conflict_handler` - Function to call to resolve snapshot conflicts `name_changeset` - Function to call for naming a pushed changeset, if necessary `progress` - Function to call for progress updates
(
database: &Database,
file: &RemoteFile,
mut conflict_handler: C,
mut name_changeset: N,
mut progress: P,
)
| 281 | /// * `name_changeset` - Function to call for naming a pushed changeset, if necessary |
| 282 | /// * `progress` - Function to call for progress updates |
| 283 | pub fn sync_database_with_progress< |
| 284 | C: DatabaseConflictHandler, |
| 285 | P: ProgressCallback, |
| 286 | N: NameChangeset, |
| 287 | >( |
| 288 | database: &Database, |
| 289 | file: &RemoteFile, |
| 290 | mut conflict_handler: C, |
| 291 | mut name_changeset: N, |
| 292 | mut progress: P, |
| 293 | ) -> Result<(), ()> { |
| 294 | let success = unsafe { |
| 295 | BNCollaborationSyncDatabase( |
| 296 | database.handle.as_ptr(), |
| 297 | file.handle.as_ptr(), |
| 298 | Some(C::cb_handle_conflict), |
| 299 | &mut conflict_handler as *mut C as *mut c_void, |
| 300 | Some(P::cb_progress_callback), |
| 301 | &mut progress as *mut P as *mut c_void, |
| 302 | Some(N::cb_name_changeset), |
| 303 | &mut name_changeset as *mut N as *mut c_void, |
| 304 | ) |
| 305 | }; |
| 306 | success.then_some(()).ok_or(()) |
| 307 | } |
| 308 | |
| 309 | /// Pull updated snapshots from the remote. Merge local changes with remote changes and |
| 310 | /// potentially create a new snapshot for unsaved changes, named via name_changeset. |
no outgoing calls
no test coverage detected