Files
plainleaf/lib/spaces/space_primitives.ts
T
Zef HemelandGitHub dc2987a3f9 Sync engine rearchitecture (#1516)
* Don't require auth for .ping
* Finally introducing loggers
* Remove file list caching from disk_space_primitives
I don't think this is required anymore with the sync model
* Simplification of space primitives and more tests
* More reliable online status
* Add .zed settings
* Remove selfUpdate argument from `writeFile` no longer used
- Add `sync` config schema and document sync options
- Move sync config handling to client boot logic
- Move BootConfig type to ui_types.ts
- Remove sync env vars from server
- Update documentation for sync and architecture
* Improve sync logic and proxy routing for full sync state
* Add BoxProxy for late-bound client and improve Lua boot
- Add isMobile syscall for editor
* Add concurrency to sync process and log indexing duration
* Better service worker lifecycle management
2025-09-12 14:43:57 +02:00

29 lines
905 B
TypeScript

import type { FileMeta } from "../../type/index.ts";
/**
* A generic interface used by `Space` to interact with the underlying storage, designed to be easy to implement for different storage backends
*/
export interface SpacePrimitives {
fetchFileList(): Promise<FileMeta[]>;
/**
* Retrieves metadata for a specific file.
* @param path The path of the file to retrieve metadata for.
* @param observing used to hint at the sync engine this file is under regular observation (and may sync more aggressively)
*/
getFileMeta(path: string, observing?: boolean): Promise<FileMeta>;
readFile(
path: string,
): Promise<{ data: Uint8Array; meta: FileMeta }>;
writeFile(
path: string,
data: Uint8Array,
// May be ignored, but ideally should be used to set the lastModified time
meta?: FileMeta,
): Promise<FileMeta>;
deleteFile(path: string): Promise<void>;
}