adjust sync package napi-rs code

This commit is contained in:
Nikita Sivukhin
2025-09-25 10:54:50 +04:00
parent f8d077c24b
commit ddfa77997d
2 changed files with 38 additions and 50 deletions

View File

@@ -7,9 +7,6 @@ use std::{
use turso_sync_engine::types::{DbChangesStatus, ProtocolCommand};
pub const GENERATOR_RESUME_IO: u32 = 0;
pub const GENERATOR_RESUME_DONE: u32 = 1;
pub trait Generator {
fn resume(&mut self, result: Option<String>) -> napi::Result<GeneratorResponse>;
}
@@ -57,6 +54,17 @@ pub enum GeneratorResponse {
},
}
#[napi]
impl SyncEngineChanges {
#[napi]
pub fn empty(&self) -> bool {
let Some(changes) = self.status.as_ref() else {
return true;
};
changes.file_slot.is_none()
}
}
#[napi]
#[derive(Clone)]
pub struct GeneratorHolder {