Path: blob/master/src/packages/sync-fs/lib/conat/syncfs-client.ts
1503 views
/*1SyncFS Client Service, which runs on compute servers2*/34import { createSyncFsClientService } from "@cocalc/conat/service/syncfs-client";5import { type SyncFS } from "../index";67export async function initConatClientService({8syncfs,9compute_server_id,10project_id,11}: {12syncfs: SyncFS;13compute_server_id: number;14project_id: string;15}) {16// sanity check17if (!compute_server_id) {18throw Error("compute_server_id must be a positive integer");19}20const impl = {21sync: async () => {22await syncfs.sync();23},2425copyFilesToHomeBase: async (opts: { paths: string[]; dest?: string }) => {26await syncfs.doApiRequest({27...opts,28event: "copy_from_compute_server_to_project",29});30},3132copyFilesFromHomeBase: async (opts: { paths: string[]; dest?: string }) => {33await syncfs.doApiRequest({34...opts,35event: "copy_from_project_to_compute_server",36});37},38};39return await createSyncFsClientService({40compute_server_id,41project_id,42impl,43});44}454647