@prismshadow/penguin-server · packages/server/src/mechanisms/deleting-folders.ts:16

DeletingFolders

interface

DeletingFolders: the mechanism DeletingFoldersService implements.

API

@Interface()
export abstract class DeletingFolders {
  abstract moveAside(abs: string, place: DeletingPlace, label: string): string | null;
  abstract purge(moved: readonly string[]): Promise<void>;
  abstract resume(within: string): Promise<void>;
  abstract deletingDirIn(within: string): string;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use
@Moduleexported by
@Provideprovided by
@Useconsumed by (1)

Members (4)

moveAside

moveAside(abs: string, place: DeletingPlace, label: string): string | null

Moves abs aside in one synchronous rename, under a unique name that starts with label (kept to the id alphabet), and answers where it now is; null when nothing is at abs. Any other failure throws, with nothing moved. Synchronous so that a caller can check that the folder may go and move it in one step: no Task can start in between, and one that starts afterwards finds the folder gone and never writes into a folder being removed.

@paramabsstring
@paramplaceDeletingPlace
@paramlabelstring
@returnsstring | null

purge

purge(moved: readonly string[]): Promise<void>

Removes the moved folders' contents in the background, one after another, through the server's filesystem throttle; resolves when all are done. What could not be removed is logged and stays where it waits: a Project's deleting folder is removed again at every start, a within one by resume.

@parammovedreadonly string[]
@returnsPromise<void>

resume

resume(within: string): Promise<void>

Removes what an earlier process left in within's deleting folder.

@paramwithinstring
@returnsPromise<void>

deletingDirIn

deletingDirIn(within: string): string

within's deleting folder: an entry of it that is not one of its own.

@paramwithinstring
@returnsstring