Keep two memo services in step, e.g. a JSON file used offline (the local
service) and a CalDAV calendar (the remote one), with synchronize. This
works just as dgknght.tasks.sync does for tasks.
Memos are matched by their :uid. What changed on each side since the last sync is found by comparing it with the base: each memo as it was when the two sides last agreed, along with each side's :etag for it where the provider has one. A memo'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.
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 memo services in step, e.g. a JSON file used offline (the local service) and a CalDAV calendar (the remote one), with `synchronize`. This works just as `dgknght.tasks.sync` does for tasks. Memos are matched by their :uid. What changed on each side since the last sync is found by comparing it with the base: each memo as it was when the two sides last agreed, along with each side's :etag for it where the provider has one. A memo'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`. 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 memo services into line: each memo 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 :memos, keyed by :uid, each with
its :memo, and each :failed operation names its :memo.
Options are :local-id and :remote-id (both required), :base, :resolve
(remote-wins by default, or local-wins) and :dry-run?.
Brings the local and remote memo services into line: each memo 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 :memos, keyed by :uid, each with its :memo, and each :failed operation names its :memo. Options are :local-id and :remote-id (both required), :base, :resolve (`remote-wins` by default, or `local-wins`) and :dry-run?.
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 |