1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { Observable } from 'rxjs';
|
9 | import { Path, PathFragment } from '../path';
|
10 | import { FileBuffer, Host, HostCapabilities, HostWatchOptions, ReadonlyHost, Stats } from './interface';
|
11 | import { SimpleMemoryHost } from './memory';
|
12 | export interface CordHostCreate {
|
13 | kind: 'create';
|
14 | path: Path;
|
15 | content: FileBuffer;
|
16 | }
|
17 | export interface CordHostOverwrite {
|
18 | kind: 'overwrite';
|
19 | path: Path;
|
20 | content: FileBuffer;
|
21 | }
|
22 | export interface CordHostRename {
|
23 | kind: 'rename';
|
24 | from: Path;
|
25 | to: Path;
|
26 | }
|
27 | export interface CordHostDelete {
|
28 | kind: 'delete';
|
29 | path: Path;
|
30 | }
|
31 | export type CordHostRecord = CordHostCreate | CordHostOverwrite | CordHostRename | CordHostDelete;
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | export declare class CordHost extends SimpleMemoryHost {
|
43 | protected _back: ReadonlyHost;
|
44 | protected _filesToCreate: Set<Path>;
|
45 | protected _filesToRename: Map<Path, Path>;
|
46 | protected _filesToRenameRevert: Map<Path, Path>;
|
47 | protected _filesToDelete: Set<Path>;
|
48 | protected _filesToOverwrite: Set<Path>;
|
49 | constructor(_back: ReadonlyHost);
|
50 | get backend(): ReadonlyHost;
|
51 | get capabilities(): HostCapabilities;
|
52 | /**
|
53 | * Create a copy of this host, including all actions made.
|
54 | * @returns {CordHost} The carbon copy.
|
55 | */
|
56 | clone(): CordHost;
|
57 | |
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | commit(host: Host, force?: boolean): Observable<void>;
|
67 | records(): CordHostRecord[];
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | create(path: Path, content: FileBuffer): Observable<void>;
|
76 | overwrite(path: Path, content: FileBuffer): Observable<void>;
|
77 | write(path: Path, content: FileBuffer): Observable<void>;
|
78 | read(path: Path): Observable<FileBuffer>;
|
79 | delete(path: Path): Observable<void>;
|
80 | rename(from: Path, to: Path): Observable<void>;
|
81 | list(path: Path): Observable<PathFragment[]>;
|
82 | exists(path: Path): Observable<boolean>;
|
83 | isDirectory(path: Path): Observable<boolean>;
|
84 | isFile(path: Path): Observable<boolean>;
|
85 | stat(path: Path): Observable<Stats | null> | null;
|
86 | watch(path: Path, options?: HostWatchOptions): null;
|
87 | willCreate(path: Path): boolean;
|
88 | willOverwrite(path: Path): boolean;
|
89 | willDelete(path: Path): boolean;
|
90 | willRename(path: Path): boolean;
|
91 | willRenameTo(path: Path, to: Path): boolean;
|
92 | }
|