IF Commons GitHub

physical/collect

Written to: 7 requirements: 5 proved, 0 partly, 2 failing, 0 with no test recorded. 0003-evidence-capture-collect FR-001, 0003-evidence-capture-collect FR-002, 0003-evidence-capture-collect FR-003, 0003-evidence-capture-collect FR-004, 0003-evidence-capture-collect FR-005, 0003-evidence-capture-collect FR-006 and 1 more

One run of the collector, with no person: it takes the lock (a second run does not wait), looks at the assets that are due with at most a few at once and a time limit each, keeps the state of an asset on the branch only where it differs from the one kept, journals each look as the policy says in a hash-chained entry, makes a commit when a state changed or the journal's batch interval has run (the entries not yet committed wait in a file of the run's own), and pushes the branch as the policy says, never forcing; a push that fails is an entry of the journal and is tried again by the next run.

import { collect } from "./collect.ts";
// const done = await collect({ store, policy, assets, observe, now: new Date().toISOString(), runtime: ".git/opsfolio-evidence" });

Source: commons/evidence-capture/src/physical/collect.ts

3 of 10 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.CollectInputtypeno test imports it
type CollectInput = { readonly store: GitRefStore; readonly policy: CapturePolicy; readonly assets: readonly Obser… (612 characters)
type CollectInput = {
  readonly store: GitRefStore;
  readonly policy: CapturePolicy;
  readonly assets: readonly Observed[];
  readonly observe: Observer;
  /** The instant of the run (ISO 8601). */
  readonly now: string;
  /** The folder of the run's own memory (outside the tracked files: the repository's `.git/opsfolio-evidence`). */
  readonly runtime: string;
  /** How many assets are looked at at once and how long each may take (8 and 15 seconds by default). */
  readonly limits?: FanOutLimits;
  /** Look at these assets only, whether or not they are due. */
  readonly only?: readonly string[];
};

What a run is given.

physical.AssetOutcometypeno test imports it
type AssetOutcome = "changed" | "unchanged" | "unreachable" | "refused" | "unreadable" | "not-due";

What happened to one asset in a run.

physical.Collectedtypeno test imports it
type Collected = {
  readonly assets: readonly { readonly id: string; readonly outcome: AssetOutcome; readonly journaled: boolean }[];
  /** The commit made, where one was. */
  readonly commit: string | undefined;
  /** The entries of the journal waiting for the next commit. */
  readonly pending: number;
  readonly pushed: "not-asked" | "pushed" | "failed" | "not-due";
};

What a run did.

physical.readJournalfunctionno test imports it
function readJournal(store: GitRefStore, at?: string | undefined): Promise<Result<readonly (Document & { readonly seq: number; readonly previous: string; readonly type: string; readonly subject: string; readonly evidence: string; readonly digest: string; } & {})[], string>>

The whole journal of the branch at a revision, read in order and verified: its entries, or the first entry that does not follow.

physical.collectfunctionno test imports it
function collect(input: CollectInput): Promise<Result<Collected, string>>

One run of the collector; an error where another run holds the lock or the branch moved while it committed.

CollectInputtypeno test imports it
type CollectInput = { readonly store: GitRefStore; readonly policy: CapturePolicy; readonly assets: readonly Obser… (612 characters)
type CollectInput = {
  readonly store: GitRefStore;
  readonly policy: CapturePolicy;
  readonly assets: readonly Observed[];
  readonly observe: Observer;
  /** The instant of the run (ISO 8601). */
  readonly now: string;
  /** The folder of the run's own memory (outside the tracked files: the repository's `.git/opsfolio-evidence`). */
  readonly runtime: string;
  /** How many assets are looked at at once and how long each may take (8 and 15 seconds by default). */
  readonly limits?: FanOutLimits;
  /** Look at these assets only, whether or not they are due. */
  readonly only?: readonly string[];
};

What a run is given.

AssetOutcometypeno test imports it
type AssetOutcome = "changed" | "unchanged" | "unreachable" | "refused" | "unreadable" | "not-due";

What happened to one asset in a run.

Collectedtypetests failing
type Collected = {
  readonly assets: readonly { readonly id: string; readonly outcome: AssetOutcome; readonly journaled: boolean }[];
  /** The commit made, where one was. */
  readonly commit: string | undefined;
  /** The entries of the journal waiting for the next commit. */
  readonly pending: number;
  readonly pushed: "not-asked" | "pushed" | "failed" | "not-due";
};

What a run did.

Imported by 7 tests of the run (6 passed, 1 failed): a state is kept only where it changed, every look is journaled, commits come whe. the library's results

readJournalfunctiontests failing
function readJournal(store: GitRefStore, at?: string | undefined): Promise<Result<readonly (Document & { readonly seq: number; readonly previous: string; readonly type: string; readonly subject: string; readonly evidence: string; readonly digest: string; } & {})[], string>>

The whole journal of the branch at a revision, read in order and verified: its entries, or the first entry that does not follow.

Imported by 11 tests of the run (10 passed, 1 failed): a state is kept only where it changed, every look is journaled, commits come whe. the library's results

collectfunctiontests failing
function collect(input: CollectInput): Promise<Result<Collected, string>>

One run of the collector; an error where another run holds the lock or the branch moved while it committed.

Imported by 19 tests of the run (18 passed, 1 failed): a state is kept only where it changed, every look is journaled, commits come whe. the library's results

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