IF Commons GitHub

physical/memory/mod

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0005-anyfs-conformance FR-003

The store in memory: every capability a store can keep without help, held in a map, and the reference every other backend is compared with. Its revision is sha256: and the digest of the bytes, so the same bytes are the same revision wherever they are; a batch is applied to a copy of the state and committed whole, so it is all or nothing; a history keeps every revision an object has had until it is deleted.

import { memoryStore } from "./mod.ts";
const store = memoryStore({ name: "scratch" });
store.id; // "memory:scratch"

Source: commons/anyfs/src/physical/memory/mod.ts

2 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.

MEMORY_CAPABILITIESconst
const MEMORY_CAPABILITIES: readonly ["read", "write", "list", "stat", "delete", "cas", "batch", "rename", "history"]

The capabilities of the store in memory.

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

MemoryStoretypeno test imports it
type MemoryStore = Store<(typeof MEMORY_CAPABILITIES)[number]>;

The type of the store in memory.

MemoryOptionstypeno test imports it
type MemoryOptions = { readonly name?: string; readonly clock?: () => number };

What the store in memory is made with: its name and the clock that dates a change, in milliseconds.

revisionOfBytesfunctionno test imports it
function revisionOfBytes(bytes: Uint8Array<ArrayBufferLike>): Promise<Revision>

The revision of some bytes: sha256: and their digest.

memoryStorefunction
function memoryStore(options?: MemoryOptions): MemoryStore

A store in memory.

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

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