Documentation
    Preparing search index...

    Interface IServantProps<Parameters>

    Properties of the servant program.

    Platform boundary: The feature location and extension describe native files separately from the connection's protocol address; relative paths use the servant's working directory.

    contracts/common.md#principled-implementation The fields define how a servant finds benchmark functions (location, extension, prefix) and how it builds their arguments (connection and parameters), which is everything discovery and invocation need.

    contracts/common.md#clear-and-simple-design A generic property record parameterized by the tuple of function arguments, with the optional extension defaulting to the built JavaScript.

    contracts/common.md#prohibited-implementation-shortcuts The extension is declared rather than inferred from the servant's own module, which once loaded no feature at all when the library was built and the features ran from TypeScript source.

    contracts/common.md#meaningful-documentation Each property documents its role, the default extension, the file-name and function-name prefix rules, and what happens when nothing matches.

    interface IServantProps<Parameters extends any[]> {
        connection: IConnection;
        extension?: string;
        location: string;
        parameters: (connection: IConnection, name: string) => Parameters;
        prefix: string;
    }

    Type Parameters

    • Parameters extends any[]
    Index
    connection: IConnection

    Default connection.

    Default connection to be used in the servant.

    extension?: string

    Extension of the benchmark function files to load, without the leading dot.

    The servant reads location and imports every file ending with this extension. Set it to match how the feature files are actually run: "js" when they are built JavaScript, or "ts" when they are executed from TypeScript source (for example under ttsx).

    "js"
    
    location: string

    Location of the benchmark functions.

    A relative path is resolved against the current working directory of the servant, the same base that lists the directory.

    parameters: (connection: IConnection, name: string) => Parameters

    Get parameters of a function.

    When composing the parameters, never forget to copy the IConnection.logger property of default connection to the returning parameters.

    Type Declaration

    contracts/common.md#principled-implementation A function from the per-request connection and the function name to the argument tuple lets each execution receive a connection whose logger records its events.

    contracts/common.md#clear-and-simple-design One callback, called per execution, with the two inputs a caller needs to build arguments.

    contracts/common.md#prohibited-implementation-shortcuts Arguments come only from the caller's function; the connection it receives is the servant's logging copy.

    contracts/common.md#meaningful-documentation The comment warns that the logger of the received connection must be carried into the returned parameters, the fact that decides whether events are recorded.

    prefix: string

    Prefix of the benchmark functions.

    Every prefixed function will be executed in the servant.

    In other words, if a function name doesn't start with the prefix, then it would never be executed. Also, when a file name (basename) does not start with the prefix, the file would never be imported either, so that every function defined in the file would never be executed.

    When no function matches, no request is executed and the report carries no events.