IF Commons GitHub

logical/context

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-query-safety FR-001, 0004-query-safety FR-002, 0004-query-safety FR-006

What a query is run with (commons anyfs-query 0004-query-safety FR-001, FR-002, FR-006): the way a place named in a query becomes a store, the consent each place is given, the budget, the clock, the paths that are never read, and an optional index of listings. Nothing here is ambient: a query reaches the places the context gives it and no other.

Source: commons/anyfs-query/src/logical/context.ts

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

Resolvedtypeno test imports it
type Resolved = { readonly place: string; readonly store: AnyStore; readonly prefix: Prefix };

A place named in a query, resolved: the store, the prefix in it where the query starts, and the name the place is called in the results.

Resolvertypeno test imports it
type Resolver = (place: string) => Result<Resolved, string>;

How a place named in a query becomes a store, or why it cannot.

PlaceInfotypeno test imports it
type PlaceInfo = { readonly uri: string; readonly kind: string; readonly capabilities: readonly string[]; readonly consistency: string; readonly maxObject?: number };

What the table places says of a place.

Indextypeno test imports it
type Index = { list(place: string, prefix: Prefix): Promise<readonly Stat[] | undefined> };

A catalog of listings: what it knows of a place below a prefix, or nothing where it does not know.

QueryClocktypeno test imports it
type QueryClock = { now(): number };

The time, in milliseconds.

QueryContexttypeno test imports it
type QueryContext = { readonly resolve: Resolver; /** What a query may do at a place. */ readonly consent: (place:… (550 characters)
type QueryContext = {
  readonly resolve: Resolver;
  /** What a query may do at a place. */
  readonly consent: (place: string) => Consent;
  /** The place a table without one reads from. */
  readonly defaultPlace?: string;
  /** The places `places` lists. */
  readonly places?: readonly PlaceInfo[];
  /** The objects that are never read, whatever the consent: their text is not known. */
  readonly redacted?: (place: string, path: Path) => boolean;
  readonly index?: Index;
  readonly budget?: Partial<Budget>;
  readonly clock: QueryClock;
};

What a query is run with.

budgetOfconstno test imports it
const budgetOf: (ctx: QueryContext) => Budget

The budget of a context, over the default.

NamedStoretypeno test imports it
type NamedStore = { readonly store: AnyStore; readonly consent?: Consent };

A store that is mounted by name.

mountTablefunctionno test imports it
function mountTable(stores: Readonly<Record<string, NamedStore>>, open?: ((place: string) => Result<Resolved, string>) | undefined): Pick<QueryContext, "consent" | "places" | "resolve">

A resolver and a consent of stores by name: fleet:/machines is the store named fleet and the prefix machines; the places places lists are the names.

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