Skip to content

Encodes a sync state to a raw vector for persistence or transmission. The encoded state can later be restored with am_sync_state_decode().

Usage

am_sync_state_encode(sync_state)

Arguments

sync_state

A sync state object (created with am_sync_state())

Value

A raw vector containing the serialized sync state.

Details

This is useful for persisting sync progress across sessions, avoiding the need to re-sync from scratch.

Examples

sync_state <- am_sync_state()

# Encode for storage
bytes <- am_sync_state_encode(sync_state)
bytes
#> [1] 43 00

# Restore later
restored <- am_sync_state_decode(bytes)
restored
#> <Automerge Sync State>