OneWaySynchronizer alternatives and similar libraries
Based on the "Data Structures / Algorithms" category.
Alternatively, view OneWaySynchronizer alternatives based on common mentions on social networks and blogs.
-
KeyPathKit
KeyPathKit is a library that provides the standard functions to manipulate data along with a call-syntax that relies on typed keypaths to make the call sites as short and clean as possible. -
BinaryKit
๐พ๐๐งฎ BinaryKit helps you to break down binary data into bits and bytes, easily access specific parts and write data to binary. -
RandMyMod
RandMyMod base on your own struct or class create one or a set of instance, which the variable's value in the instance is automatic randomized.
CodeRabbit: AI Code Reviews for Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of OneWaySynchronizer or a related project?
README
Purpose
The simplest abstraction to synchronize local data with remote source. For iOS, written in swift.
Overview
Many applications uses remote servers as sources for some data rendered later to user. Synchronization process is used to fetch data from remote server and store them locally. This operation consists of some standard stages: fetch, compare, diff, download new, etc... This module was created to simplify synchronization process by implementing all logic inside with interaction via protocol with external 'so-called' processor. All you need, just implement all requied async methods. All items should be unique and must have string unique keys. Synchronizer does not define order of items, it is responsibility of programmer. Demo example, fills order from server response and then sort items according to it.
Installation
Cocoapods
pod "OneWaySynchronizer"
Manually
Clone repository and add files from Source
folder to project.
Usage
For detailed example see [Demo](Demo) folder.
OneWaySynchronizer
Syncrhonization flow
sync()
โ
post OneWaySynchronizerDidChangeSyncStatusNotification
โ
[called at the beginning of synchronization process]
owsSyncBegin
โ
[return list of items from remote source, for example, from server]
owsFetchSourceList
โ โ
โโ< err ok
โ โ
โ [return unique keys of locally existing items]
โ owsGetLocalKeys
โ โ โ
โโ< err ok
โ โ
โ [remove local items, because their keys were not found in source list]
โ owsRemoveLocalItems
โ โ โ
โโ< err ok
โ โ
โ [define if synchronizer should update already existing item]
โ owsShouldUpdateItem
โ โ โ
โโ< err ok
โ โ
โ [here you can reorder, filter items for next download operations]
โ owsPrepareDownload
โ โ โ
โโ< err ok
โ โ
โ [download preview of item if necessary]
โ owsDownloadItemPreview <โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ โ
โโ< err ok >โโ concurrent loop for all previews โโโ
โ โ
โ [download main content of item if necessary]
โ owsDownloadItem <โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ โ
โโ< err ok >โโ concurrent loop for all previews โโ
โ โ
โ [called after synchronization process]
โ> owsSyncEnd
โ
sync completions
โ
post OneWaySynchronizerDidChangeSyncStatusNotification
Methods
func sync(completion: @escaping OwsSyncCompletion = { _ in })
Starts synchronization process. If another process is in progress, then after its completion new synchronization will be initiated, both completion callbacks will be called at the end of the last synchronization.
func cancel()
Cancels currently running synchonization. If no any synchronization is running, then does nothing.
Options
concurrency
- number of concurrent tasks while downloading. 0 - means auto. Default is 0.downloadPreview
- if true, then synchonizer should call method for preview downloading. Default is false.downloadContent
- if true, then synchonizer should call method for content downloading. Default is true.stopOnError
- if true, then sync will stop as soon as possible after first error. Default is true.
Changes
See [CHANGELOG](CHANGELOG.md)
License
MIT. See [LICENSE](LICENSE)
Author
Siarhei Ladzeika [email protected]
*Note that all licence references and agreements mentioned in the OneWaySynchronizer README section above
are relevant to that project's source code only.