IF Commons GitHub

logical/nfs3

Written to: 8 requirements: 8 proved, 0 partly, 0 failing, 0 with no test recorded. 0006-anyfs-serve-nfs FR-004, 0006-anyfs-serve-nfs FR-009, 0006-anyfs-serve-nfs FR-005, 0006-anyfs-serve-nfs FR-006, 0006-anyfs-serve-nfs FR-007, 0006-anyfs-serve-nfs FR-008 and 2 more

NFS version 3 and its mount protocol over the POSIX view of a store: nfsService(view, options) gives one function that takes a call of ONC RPC and gives the bytes of its reply, with nothing of a socket in it. A file handle is the boot identity of the server and a number the server gives a path (a bounded table, so a handle that is not known is NFS3ERR_STALE); the attributes of an object are those of its stat, with a time that changes with its revision where the store keeps none; a write is held in a buffer of the whole object and put as one object at COMMIT, at a write that asks for stable storage, when the buffer has been idle, before a rename and at the end; and what the store cannot keep (links, nodes, modes, owners, times) is refused, or accepted and counted where the person asked for that. The status of a failure is the table of nfsStatusOfErrno over the code the view gave, and every operation tells onEvent how it was carried out.

import { posix } from "@intellectual-frontiers/anyfs-posix/physical";
import { memoryStore } from "@intellectual-frontiers/anyfs/memory";
import { nfsService } from "./nfs3.ts";
const service = nfsService(posix(memoryStore()), {});
service.boot.length; // 8

Source: commons/anyfs-serve/src/logical/nfs3.ts

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

NfsEventtype
type NfsEvent = { readonly proc: NfsProcedure | "MNT" | "UMNT" | "UMNTALL" | "EXPORT" | "DUMP"; readonly path?: stri… (412 characters)
type NfsEvent = {
  readonly proc: NfsProcedure | "MNT" | "UMNT" | "UMNTALL" | "EXPORT" | "DUMP";
  readonly path?: string;
  readonly status: number;
  readonly fidelity: Fidelity;
  /** The uid the call said it was, where it said one. */
  readonly uid?: number;
  /** What the operation noticed on the way (the mode of a create that is not kept, an attribute that was dropped). */
  readonly note?: string;
};

What the service tells of one operation: the procedure, the path, the status given and how it was carried out.

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

NfsOptionstypeno test imports it
type NfsOptions = { /** The path a client mounts: `/` by default. */ readonly exportPath?: string; /** Refuse ever… (1012 characters)
type NfsOptions = {
  /** The path a client mounts: `/` by default. */
  readonly exportPath?: string;
  /** Refuse every change. */
  readonly readOnly?: boolean;
  /** The uids that may ask (the `AUTH_SYS` of the call); anyone where it is not given. */
  readonly uids?: readonly number[];
  /** What to do with a mode, an owner or a time the store cannot keep: refuse it (the default) or accept it without effect and count it. */
  readonly attributes?: "refuse" | "ignore";
  /** The largest object, in bytes: 64 MiB by default. */
  readonly maxFileBytes?: number;
  /** The most file handles held: 65536 by default. */
  readonly maxHandles?: number;
  /** How long a buffer is idle before it is put, in milliseconds: 2000 by default. */
  readonly flushAfterMs?: number;
  /** The time in milliseconds; the clock by default. */
  readonly clock?: () => number;
  /** The identity of this boot, 8 bytes; random by default. */
  readonly boot?: Uint8Array;
  readonly onEvent?: (event: NfsEvent) => void;
};

What the service is told.

NfsServicetypeno test imports it
type NfsService = { /** Answers a call with the bytes of its reply. */ handle(call: RpcCall): Promise<Uint8Array>; … (459 characters)
type NfsService = {
  /** Answers a call with the bytes of its reply. */
  handle(call: RpcCall): Promise<Uint8Array>;
  /** Puts every buffer that holds a write; the failures are given. */
  flushAll(): Promise<readonly string[]>;
  /** The identity of this boot: the write verifier and the first part of every handle. */
  readonly boot: Uint8Array;
  /** How many attributes were accepted without effect (`attributes: "ignore"`). */
  dropped(): number;
};

A running service.

fileidOffunctionno test imports it
function fileidOf(path: string): bigint

A stable number for a path, for the fileid of an object: FNV-1a of its bytes, kept to 52 bits, never 0.

nfsServicefunctionno test imports it
function nfsService(view: Posix, options: NfsOptions): NfsService

The service over a view.

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