Skip to content

Add RealtimeSyncOff and refactor interface of SyncMode#170

Merged
7hong13 merged 6 commits intomainfrom
sync_mode
Apr 15, 2024
Merged

Add RealtimeSyncOff and refactor interface of SyncMode#170
7hong13 merged 6 commits intomainfrom
sync_mode

Conversation

@7hong13
Copy link
Contributor

@7hong13 7hong13 commented Apr 15, 2024

What this PR does / why we need it?

The SyncOff mode will allow users to maintain the watch stream functionality while disabling synchronization.

- 1️⃣ With the addition of the `RealtimeSyncOff` mode, the `SyncMode` has been simplified into four options. Usage is as follows:

// as-is
await client.pause(doc); // manual sync
await client.resume(doc); // realtime sync(pushpull)
client.pauseRemoteChanges(doc); // pushonly 
client.resumeRemoteChanges(doc); // pushpull 

// to-be
await client.changeSyncMode(doc, SyncMode.Manual);
await client.changeSyncMode(doc, SyncMode.Realtime); // Same as PushPull mode
await client.changeSyncMode(doc, SyncMode.RealtimePushOnly); 
await client.changeSyncMode(doc, SyncMode.RealtimeSyncOff); // Added RealtimeSyncOff mode 

- 2️⃣ In manual sync mode, the `sync()` function can now only be executed in pushpull mode.

await client.sync(doc, SyncMode.PushOnly) // Deprecated: Only pushpull synchronization is supported now.

- 3️⃣ The option to specify manual sync during attachment has been updated.

// as-is 
await client.attach(doc, { isRealtimeSync: false });

// to-be
await client.attach(doc, { syncMode: SyncMode.Manual });

Any background context you want to provide?

What are the relevant tickets?

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@7hong13 7hong13 added the enhancement 🌟 New feature or request label Apr 15, 2024
@7hong13 7hong13 added this to the 0.4.16 milestone Apr 15, 2024
@7hong13 7hong13 requested review from hackerwins and skhugh April 15, 2024 03:09
@7hong13 7hong13 self-assigned this Apr 15, 2024
@7hong13
Copy link
Contributor Author

7hong13 commented Apr 15, 2024

it seems like codecov keeps failing since it doesn't support tokenless uploading anymore.

(cc. @hackerwins )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 🌟 New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants