Path: blob/master/src/packages/conat/service/syncfs-client.ts
1452 views
/*1This is a *service* that runs in the filesystem part of a compute server.23It's called "syncfs-client" because it runs on the client part of the filesystem4that compute servers use.5*/67import { createServiceClient, createServiceHandler } from "./typed";89interface SyncFsApiClient {10// cause the compute server to initiate a sync asap.11sync: () => Promise<void>;1213// copy files from compute server to the home base14copyFilesToHomeBase: (opts: {15paths: string[];16dest?: string;17}) => Promise<void>;1819// copy files from the home base to the compute server20copyFilesFromHomeBase: (opts: {21paths: string[];22dest?: string;23}) => Promise<void>;24}2526export function syncFsClientClient({27compute_server_id,28project_id,29// default is large, because sync tends to take a30// longer time, as does copying files around.31timeout = 90000,32}: {33compute_server_id: number;34project_id: string;35timeout?: number;36}) {37return createServiceClient<SyncFsApiClient>({38project_id,39compute_server_id,40service: "syncfs-client",41timeout,42});43}4445export async function createSyncFsClientService({46compute_server_id,47project_id,48impl,49}: {50project_id: string;51compute_server_id: number;52impl: SyncFsApiClient;53}) {54return await createServiceHandler<SyncFsApiClient>({55project_id,56compute_server_id,57service: "syncfs-client",58description: "SyncFs client service that runs on each compute server.",59impl,60});61}626364