Record local edits#
Record each change your application makes as you make it, and the next sync sends it.
Create and change#
lunch = adapter.create(b"Lunch with Ana")
meeting = replica.find_record("work", "meeting")
if meeting is not None:
adapter.change(meeting.local_key, b"Team meeting, room 3")
adapter.sync()
create() returns the new record’s local key, which stays the same once the server gives the object an id.
Undo an edit#
adapter.change(lunch, b"Lunch with Ana and Ben")
replica.discard(lunch)
discard() drops an edit the server hasn’t received.
Delete#
replica.delete(lunch)
adapter.sync()
An event with an open conflict takes no edit until you resolve it, as Resolve conflicts shows.