IF Commons GitHub

physical/posix

Written to: 7 requirements: 7 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-anyfs-posix-physical FR-001, 0004-anyfs-posix-physical FR-002, 0004-anyfs-posix-physical FR-003, 0004-anyfs-posix-physical FR-004, 0004-anyfs-posix-physical FR-005, 0004-anyfs-posix-physical FR-007 and 1 more

The view of a store as a file system. posix(store) makes a Posix that carries out each operation by the plan the logical layer gives it for the capabilities of the store, and every result carries the fidelity of that plan. Directories are read from lists, an object is written through a buffer that is put at close, a rename is the store's where it has one and a copy and a delete where it has not, and what a store cannot do is refused with a code and a reason. Nothing is kept in the process but the three values the program passed: the policy, the working directory and the handles.

import { memoryStore } from "@intellectual-frontiers/anyfs/memory";
import { posix } from "./posix.ts";
const view = posix(memoryStore({ name: "scratch" }));
await view.writeFile("/fleet/olympia.json", new TextEncoder().encode("{}"));
const listing = await view.readdir("/fleet"); // [{ name: "olympia.json", type: "file", size: 2, ... }]

Source: commons/anyfs-posix/src/physical/posix.ts

1 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

physical.posixfunctionno test imports it
function posix(store: Store<Viewable>, options?: PosixOptions): Posix

The view of a store as a file system, with the policy, the working directory and the table of handles the program gives.

physical.Viewabletypeno test imports it
type Viewable = "read" | "list" | "stat";

The capabilities a store must have to be viewed as a file system: the three that read. What it can write is read from its capabilities, and a view of a store that cannot be written refuses what would change it.

posixfunction
function posix(store: Store<Viewable>, options?: PosixOptions): Posix

The view of a store as a file system, with the policy, the working directory and the table of handles the program gives.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

Viewabletypeno test imports it
type Viewable = "read" | "list" | "stat";

The capabilities a store must have to be viewed as a file system: the three that read. What it can write is read from its capabilities, and a view of a store that cannot be written refuses what would change it.

Titles, headings, exports, tables, columns and requirements. Esc closes.