Keep two task services in step, e.g. a JSON file used offline (the local
service) and a CalDAV calendar (the remote one), with synchronize.
Tasks are matched by their :uid. What changed on each side since the last sync is found by comparing it with the base: each task as it was when the two sides last agreed, along with each side's :etag for it where the provider has one. A task's :url and :etag are the provider's, not part of its content, and aren't copied from one side to the other.
The base belongs to the pair of services, so synchronize takes it and
returns the new one, and the app keeps it wherever it likes, written out
with serialize-base and read back with parse-base.
Memos are synchronized the same way by dgknght.memos.sync.
Failures throw an ex-info whose data has a :type of:
::invalid-options The options map isn't valid ::wrong-base The base was made for a different pair of services ::invalid-base The base can't be parsed
Keep two task services in step, e.g. a JSON file used offline (the local service) and a CalDAV calendar (the remote one), with `synchronize`. Tasks are matched by their :uid. What changed on each side since the last sync is found by comparing it with the base: each task as it was when the two sides last agreed, along with each side's :etag for it where the provider has one. A task's :url and :etag are the provider's, not part of its content, and aren't copied from one side to the other. The base belongs to the pair of services, so `synchronize` takes it and returns the new one, and the app keeps it wherever it likes, written out with `serialize-base` and read back with `parse-base`. Memos are synchronized the same way by `dgknght.memos.sync`. Failures throw an ex-info whose data has a :type of: ::invalid-options The options map isn't valid ::wrong-base The base was made for a different pair of services ::invalid-base The base can't be parsed
(local-wins conflict)Resolves a conflict in favor of the local side.
Resolves a conflict in favor of the local side.
(parse-base s)Reads a base written by serialize-base.
Reads a base written by `serialize-base`.
(remote-wins conflict)Resolves a conflict in favor of the remote side. The default.
Resolves a conflict in favor of the remote side. The default.
(serialize-base base)The base as a JSON string, which parse-base reads back unchanged.
The base as a JSON string, which `parse-base` reads back unchanged.
(synchronize local remote options)Brings the local and remote task services into line: each task created,
updated or deleted on one side since the last sync is created, updated or
deleted on the other, as described in dgknght.sync/synchronize. The
returned :base holds its entries under :tasks, keyed by :uid, each with
its :task, and each :failed operation names its :task.
Options are :local-id and :remote-id (both required), :base, :resolve
(remote-wins by default, or local-wins) and :dry-run?.
Creates are carried out before updates, so that a completed occurrence is saved before its recurring task moves on.
Brings the local and remote task services into line: each task created, updated or deleted on one side since the last sync is created, updated or deleted on the other, as described in `dgknght.sync/synchronize`. The returned :base holds its entries under :tasks, keyed by :uid, each with its :task, and each :failed operation names its :task. Options are :local-id and :remote-id (both required), :base, :resolve (`remote-wins` by default, or `local-wins`) and :dry-run?. Creates are carried out before updates, so that a completed occurrence is saved before its recurring task moves on.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |