As of v18, sync v2 is now available to opt-in
Hey! I think we’re finally ready
I’ve mentioned it a whole bunch over the past few months, but I’ve been working on replacing Atuin’s sync with something much more flexible, resilient, and performance (both in terms of time, and network usage).
You may have seen references to “records” in Atuin’s sync output. These are generic syncable-things. Currently used by the kv store, and now by history too!
How to use
All machines must run the same version of sync - so if you enable record sync on one machine, but not another, they will not sync with each other.
Setup
- Ensure you’re running at least atuin v18
- Add this to your
~/.config/atuin/config.toml
:
[sync]
records = true
- Run
atuin sync
. - If prompted by (3), run
atuin history init-store
. This will copy all of your history fromhistory.db
intorecords.db
. Then runatuin sync
again. This is only required when you’ve used the old sync, to ensure sync v2 is all caught up with old data.
At any time, run atuin store status
to see what’s going on with your stores.
More details
records.db
store an encrypted (on disk) “log” of records. For history, this is Create(History),
or Delete(HistoryId)
. This is then “built” into history.db
, which turns it into a searchable format that can be used by the history TUI, search, etc. Records works great for sync and long term storage, history is great for actual usage. This makes things much simpler + more flexible.
You can trigger a “rebuild” manually with
atuin store rebuild history
One issue that has appeared a bunch with the “old” sync is when users have mixed keys. Maybe they paste it wrong, forget it, whatever. Their remote account ends up with history encrypted with a variety of keys, which causes sync to fail. The only solution here was to delete your account and start afresh.
This worked fine, as history was store unencrypted locally.
Now that we are storing it encrypted locally and syncing from there, it’s a little more complicated.
The new sync provides new operations to both check the state of the local store, and to recovery. I’ll provide more details on those later!