Learn R Programming

automerge (version 0.3.0)

am_save_incremental: Save incremental changes

Description

Serializes only the changes made since the last call to am_save() or am_save_incremental(). This is more efficient than saving the entire document when only a few changes have been made.

Usage

am_save_incremental(doc)

Value

A raw vector containing the incremental changes. May be empty (zero-length) if no new changes have been made since the last save.

Arguments

doc

An Automerge document

Details

Use am_load_incremental() to apply these changes to another document.

See Also

am_load_incremental(), am_save()

Examples

Run this code
doc <- am_create()
doc$key <- "value"
am_commit(doc)

# Save full document
full <- am_save(doc)

# Make more changes
doc$key2 <- "value2"
am_commit(doc)

# Save only the new changes
incremental <- am_save_incremental(doc)
length(incremental) < length(full)  # TRUE (smaller)

am_close(doc)

Run the code above in your browser using DataLab