silverbullet/plug-api/syscalls/sync.ts

36 lines
903 B
TypeScript
Raw Permalink Normal View History

import { syscall } from "../syscall.ts";
2023-01-13 22:41:29 +08:00
2024-08-07 19:27:25 +08:00
/**
* Syscalls that interact with the sync engine (when the client runs in Sync mode)
2024-08-09 15:27:58 +08:00
* @module
2024-08-07 19:27:25 +08:00
*/
/**
* Checks if a sync is currently in progress
*/
export function isSyncing(): Promise<boolean> {
return syscall("sync.isSyncing");
2023-01-13 22:41:29 +08:00
}
2024-08-07 19:27:25 +08:00
/**
* Checks if an initial sync has completed
*/
export function hasInitialSyncCompleted(): Promise<boolean> {
return syscall("sync.hasInitialSyncCompleted");
2023-01-13 22:41:29 +08:00
}
2024-08-07 19:27:25 +08:00
/**
* Actively schedules a file to be synced. Sync will happen by default too, but this prioritizes the file.
* @param path the path to the file to sync
*/
export function scheduleFileSync(path: string): Promise<void> {
return syscall("sync.scheduleFileSync", path);
}
2023-08-16 02:24:02 +08:00
2024-08-07 19:27:25 +08:00
/**
* Schedules a sync of without waiting for the usual sync interval.
*/
2023-08-16 02:24:02 +08:00
export function scheduleSpaceSync(): Promise<number> {
return syscall("sync.scheduleSpaceSync");
}