MCPcopy
hub / github.com/foambubble/foam / IDataStore

Interface IDataStore

packages/foam-core/src/services/datastore.ts:8–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6 * Represents a source of files and content
7 */
8export interface IDataStore {
9 /**
10 * List the URIs known to this store.
11 *
12 * With no argument, returns the full set of URIs the store can see (the
13 * usual workspace enumeration).
14 *
15 * When a workspace-relative glob `pattern` is passed, the store **must**
16 * return only URIs matching that glob.
17 */
18 list: (pattern?: string) => Promise<URI[]>;
19
20 /**
21 * Read the content of the file from the store
22 *
23 * Returns `null` in case of errors while reading
24 */
25 read: (uri: URI) => Promise<string | null>;
26
27 /**
28 * Write content to the file. Creates parent directories as needed.
29 * Overwrites existing files.
30 */
31 write: (uri: URI, content: string) => Promise<void>;
32
33 /**
34 * Delete the file at the given URI. No-op if it doesn't exist.
35 */
36 delete: (uri: URI) => Promise<void>;
37
38 /**
39 * Move (rename) a file from one URI to another. Creates destination
40 * parent directories as needed. Atomic where the underlying filesystem
41 * supports it.
42 */
43 move: (from: URI, to: URI) => Promise<void>;
44
45 /**
46 * Returns true if the file exists at the given URI.
47 */
48 exists: (uri: URI) => Promise<boolean>;
49}
50
51export interface IWatcher {
52 onDidChange: Event<URI>;

Callers

nothing calls this directly

Implementers 6

FileDataStorepackages/foam-vscode/src/test/test-dat
InMemoryDataStorepackages/foam-cli/src/test/test-utils.
NodeFileDataStorepackages/foam-cli/src/support/filesyst
InMemoryDataStorepackages/foam-core/test/test-utils.ts
FileDataStorepackages/foam-core/test/test-datastore
GenericDataStorepackages/foam-core/src/services/datast

Calls

no outgoing calls

Tested by

no test coverage detected