Skip to content

Server-initiated mutations #42

@carlsverre

Description

@carlsverre

Plan

Expose a new APIs on the CoordinatorDocument type called mutate_direct which takes a callback of the form (tx: &mut Transaction) -> Result<()>. Internally it grabs a txn from sqlite, runs the cb, runs storage.commit and then returns. If the cb fails, the txn will be rolled back (and possibly storage reverted).

Note: this api is specifically designed to discourage long-lived txns as SQLSync is single threaded and thus while this txn runs no other mutations can execute.

Discussed in #41

Originally posted by matthewgapp January 4, 2024
I have an instance of the coordinator running on our server and I am using the pluggable reducer I wrote (#40). But it's not quite enough, because I need to incorporate server-initiated mutations that are then synced to all clients. Is there an existing API I can use? Perhaps the write_lsn method?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions