IF Commons GitHub

probe

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-s3-store FR-008

What an endpoint keeps, found by asking it and never by assuming: S3-compatible services differ in whether they honour a condition on a write (If-None-Match: *, If-Match) and on a delete (If-Match), and a store that claimed compare-and-write on one that ignores the condition would let two writers both win. The probe writes an object of its own below the prefix of the store (a name that begins with .anyfs-probe- and a random text, which the store never shows), asks each question with the object in a state that decides it, and removes the object whatever the answers were. An answer that is not the one that proves the condition honoured (a 200 where a 412 was due, or any other failure) is a condition not kept: the store is then made without cas. A key the credentials may not write is a store that can only read.

import { casOf } from "./probe.ts";
casOf({ writable: true, ifNoneMatch: true, ifMatch: true, conditionalDelete: true, checksum: false }); // true

Source: commons/anyfs-s3/src/probe.ts

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

casOfconstno test imports it
const casOf: (f: Facts) => boolean

Whether the endpoint keeps what compare-and-write needs: every condition.

createBucketfunctionno test imports it
function createBucket(client: S3Client, region: string): Promise<Result<void, string>>

Makes the bucket of a client where it is not there (the endpoint of a test, or a first run); it is a no-op where the bucket is already the caller's.

describeCallErrorfunctionno test imports it
function describeCallError(e: CallError): string

The sentence a call error is, for the person who opens a store.

Factstypeno test imports it
type Facts = { /** Whether the credentials may write. Where they may not, nothing else is known. */ readonly writabl… (629 characters)
type Facts = {
  /** Whether the credentials may write. Where they may not, nothing else is known. */
  readonly writable: boolean;
  /** Whether a write with `If-None-Match: *` fails where an object is. */
  readonly ifNoneMatch: boolean;
  /** Whether a write with `If-Match` fails where the entity tag is another and succeeds where it is the same. */
  readonly ifMatch: boolean;
  /** Whether a delete with `If-Match` fails where the entity tag is another and keeps the object. */
  readonly conditionalDelete: boolean;
  /** Whether the service checks and returns `x-amz-checksum-sha256`. */
  readonly checksum: boolean;
};

What an endpoint was found to keep.

probeEndpointfunctionno test imports it
function probeEndpoint(client: S3Client, base: string, random?: () => string): Promise<Result<Facts, string>>

The probe of an endpoint below the key prefix of a store: the facts, or why the bucket cannot be used at all.

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