2024-02-09 04:00:45 +08:00
|
|
|
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
|
|
|
|
*/
|
2023-05-24 02:53:53 +08:00
|
|
|
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
|
|
|
|
*/
|
2023-05-24 02:53:53 +08:00
|
|
|
export function hasInitialSyncCompleted(): Promise<boolean> {
|
|
|
|
return syscall("sync.hasInitialSyncCompleted");
|
2023-01-13 22:41:29 +08:00
|
|
|
}
|
2023-08-06 03:09:41 +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
|
|
|
|
*/
|
2023-08-06 03:09:41 +08:00
|
|
|
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");
|
|
|
|
}
|