import { Span } from 'opentracing'; import { Observable } from 'rxjs'; import { InMemoryFileSystem } from './memfs'; export interface FileSystem { /** * Returns all files in the workspace under base * * @param base A URI under which to search, resolved relative to the rootUri * @return An Observable that emits URIs */ getWorkspaceFiles(base?: string, childOf?: Span): Observable; /** * Returns the content of a text document * * @param uri The URI of the text document, resolved relative to the rootUri * @return An Observable that emits the text document content */ getTextDocumentContent(uri: string, childOf?: Span): Observable; } export declare class LocalFileSystem implements FileSystem { private rootUri; /** * @param rootUri The root URI that is used if `base` is not specified */ constructor(rootUri: string); /** * Converts the URI to an absolute path on the local disk */ protected resolveUriToPath(uri: string): string; getWorkspaceFiles(base?: string): Observable; getTextDocumentContent(uri: string): Observable; } /** * Synchronizes a remote file system to an in-memory file system * * TODO: Implement Disposable with Disposer */ export declare class FileSystemUpdater { private remoteFs; private inMemoryFs; /** * Observable for a pending or completed structure fetch */ private structureFetch?; /** * Map from URI to Observable of pending or completed content fetch */ private fetches; /** * Limits concurrent fetches to not fetch thousands of files in parallel */ private concurrencyLimit; constructor(remoteFs: FileSystem, inMemoryFs: InMemoryFileSystem); /** * Fetches the file content for the given URI and adds the content to the in-memory file system * * @param uri URI of the file to fetch * @param childOf A parent span for tracing * @return Observable that completes when the fetch is finished */ fetch(uri: string, childOf?: Span): Observable; /** * Returns a promise that is resolved when the given URI has been fetched (at least once) to the in-memory file system. * This function cannot be cancelled because multiple callers get the result of the same operation. * * @param uri URI of the file to ensure * @param childOf An OpenTracing span for tracing * @return Observable that completes when the file was fetched */ ensure(uri: string, childOf?: Span): Observable; /** * Fetches the file/directory structure for the given directory from the remote file system and saves it in the in-memory file system * * @param childOf A parent span for tracing */ fetchStructure(childOf?: Span): Observable; /** * Returns a promise that is resolved as soon as the file/directory structure for the given directory has been synced * from the remote file system to the in-memory file system (at least once) * * @param span An OpenTracing span for tracing */ ensureStructure(childOf?: Span): Observable; /** * Invalidates the content fetch cache of a file. * The next call to `ensure` will do a refetch. * * @param uri URI of the file that changed */ invalidate(uri: string): void; /** * Invalidates the structure fetch cache. * The next call to `ensureStructure` will do a refetch. */ invalidateStructure(): void; }