logical.Basetypeno test imports ittype Base = { readonly kind: "absent" } | { readonly kind: "rev"; readonly rev: Revision };What an open object was when it was read: no object, or the object at a revision.
The handles of the view: what an open object holds, and the table that gives each a number. An object is written through a buffer that holds the whole of it (a store puts whole objects), so a handle has the bytes it read at open, the revision they were at (or that there was none), where the next read or write is and whether anything was written. The table is a value a program passes to the view; there is no table in the process.
import { newHandleTable, writeAt } from "./handles.ts";
writeAt(new Uint8Array([1, 2]), 4, new Uint8Array([9])).length; // 5: the gap is zeroslogical.Basetypeno test imports ittype Base = { readonly kind: "absent" } | { readonly kind: "rev"; readonly rev: Revision };What an open object was when it was read: no object, or the object at a revision.
logical.OpenFiletypeno test imports ittype OpenFile = {
readonly fd: Fd;
readonly path: PosixPath;
readonly storePath: Path;
readonly flags: OpenFlags;
base: Base;
bytes: Uint8Array;
position: number;
dirty: boolean;
};An open object. Its fields change as it is read and written, and only the view changes them.
logical.HandleTabletypeno test imports ittype HandleTable = {
/** Opens an object and gives its number. */
open(file: Omit<OpenFile, "fd">): Fd;
get(fd: Fd): OpenFile | undefined;
/** Lets a number go. */
release(fd: Fd): void;
/** How many are open. */
readonly size: number;
};The open objects, by number.
logical.newHandleTablefunctionno test imports itfunction newHandleTable(): HandleTableA table with nothing open. Numbers start at 3, as a process's do after its three standard streams.
logical.writeAtfunctionno test imports itfunction writeAt(bytes: Uint8Array<ArrayBufferLike>, offset: number, data: Uint8Array<ArrayBufferLike>): Uint8Array<ArrayBufferLike>The bytes with some written at an offset: past the end, the gap is zeros.
logical.resizefunctionno test imports itfunction resize(bytes: Uint8Array<ArrayBufferLike>, length: number): Uint8Array<ArrayBufferLike>The bytes made as long as asked: cut where longer, and padded with zeros where shorter.
logical.concatfunctionno test imports itfunction concat(bytes: Uint8Array<ArrayBufferLike>, more: Uint8Array<ArrayBufferLike>): Uint8Array<ArrayBufferLike>The bytes with others added at the end.
Basetypeno test imports ittype Base = { readonly kind: "absent" } | { readonly kind: "rev"; readonly rev: Revision };What an open object was when it was read: no object, or the object at a revision.
OpenFiletypeno test imports ittype OpenFile = {
readonly fd: Fd;
readonly path: PosixPath;
readonly storePath: Path;
readonly flags: OpenFlags;
base: Base;
bytes: Uint8Array;
position: number;
dirty: boolean;
};An open object. Its fields change as it is read and written, and only the view changes them.
HandleTabletypeno test imports ittype HandleTable = {
/** Opens an object and gives its number. */
open(file: Omit<OpenFile, "fd">): Fd;
get(fd: Fd): OpenFile | undefined;
/** Lets a number go. */
release(fd: Fd): void;
/** How many are open. */
readonly size: number;
};The open objects, by number.
newHandleTablefunctionfunction newHandleTable(): HandleTableA table with nothing open. Numbers start at 3, as a process's do after its three standard streams.
writeAtfunctionfunction writeAt(bytes: Uint8Array<ArrayBufferLike>, offset: number, data: Uint8Array<ArrayBufferLike>): Uint8Array<ArrayBufferLike>The bytes with some written at an offset: past the end, the gap is zeros.
resizefunctionfunction resize(bytes: Uint8Array<ArrayBufferLike>, length: number): Uint8Array<ArrayBufferLike>The bytes made as long as asked: cut where longer, and padded with zeros where shorter.
concatfunctionfunction concat(bytes: Uint8Array<ArrayBufferLike>, more: Uint8Array<ArrayBufferLike>): Uint8Array<ArrayBufferLike>The bytes with others added at the end.