effect-tea-persistent
    Preparing search index...

    An entity of a world: what a rehearsal does to one entity, and the runs of its operations (decision 0131).

    interface Member<T extends Types> {
        answer: {
            <K extends string>(
                key: K,
                ...rest: [...parameter: Parameter<T, K>[], message: T["internal"]],
            ): Effect<"Delivered" | "Dropped">;
            (
                pending: Pending,
                message: T["internal"],
            ): Effect<"Delivered" | "Dropped">;
        };
        fire: {
            <K extends string>(
                key: K,
                ...parameter: Parameter<T, K>,
            ): Effect<"Delivered" | "Dropped">;
            (pending: Pending): Effect<"Delivered" | "Dropped">;
        };
        pending: <K extends string>(
            key: K,
            ...parameter: Parameter<T, K>,
        ) => Effect<PendingOf<T>>;
        projection: Effect<T["projection"]>;
        run: {
            (
                pending: Pending,
            ): Effect<
                "Delivered"
                | "Dropped",
                never,
                Exclude<T["services"], Entities>,
            >;
            (
                pending: Pending,
                options: Readonly<{ crash: true }>,
            ): Effect<void, never, Exclude<T["services"], Entities>>;
            <K extends string>(
                key: K,
                ...parameter: Parameter<T, K>,
            ): Effect<
                "Delivered"
                | "Dropped",
                never,
                Exclude<T["services"], Entities>,
            >;
            <K extends string>(
                key: K,
                ...rest: [
                    ...parameter: Parameter<T, K>[],
                    options: Readonly<{ crash: true }>,
                ],
            ): Effect<void, never, Exclude<T["services"], Entities>>;
        };
        send: (
            message: T["inbound"],
            ...request: SentBy<T>,
        ) => Effect<Readonly<{ _tag: "Reused" }> | StoredReply<T["rejection"]>>;
        sendFrom: (
            message: T["inbound"],
            entity: Address,
        ) => Effect<StoredReply<T["rejection"]>>;
        state: Effect<T["state"]>;
        underWay: <K extends string>(
            key: K,
            ...parameter: Parameter<T, K>,
        ) => Effect<PendingOf<T> | null>;
    }

    Type Parameters

    Hierarchy

    • Acts<T>
      • Member
    Index
    answer: {
        <K extends string>(
            key: K,
            ...rest: [...parameter: Parameter<T, K>[], message: T["internal"]],
        ): Effect<"Delivered" | "Dropped">;
        (pending: Pending, message: T["internal"]): Effect<"Delivered" | "Dropped">;
    }

    Completes an operation with message. It is dropped when the operation's incarnation has moved on. It fails the test when the step that handles it returns the same operation under its key, which would run again at once. Given a key, it completes the work under way under the key, and fails the test when there is none (decision 0186).

    fire: {
        <K extends string>(
            key: K,
            ...parameter: Parameter<T, K>,
        ): Effect<"Delivered" | "Dropped">;
        (pending: Pending): Effect<"Delivered" | "Dropped">;
    }

    The time of a timer comes. Given a key, it is the timer under way under the key's (decision 0186).

    pending: <K extends string>(
        key: K,
        ...parameter: Parameter<T, K>,
    ) => Effect<PendingOf<T>>

    The work under way under key, one of the program's own (decision 0033), with its parameter for a key that takes one (decision 0132). Fails the test when there is none.

    projection: Effect<T["projection"]>

    The entity's projection, as a caller reads it after the last act of the test.

    run: {
        (
            pending: Pending,
        ): Effect<"Delivered" | "Dropped", never, Exclude<T["services"], Entities>>;
        (
            pending: Pending,
            options: Readonly<{ crash: true }>,
        ): Effect<void, never, Exclude<T["services"], Entities>>;
        <K extends string>(
            key: K,
            ...parameter: Parameter<T, K>,
        ): Effect<"Delivered" | "Dropped", never, Exclude<T["services"], Entities>>;
        <K extends string>(
            key: K,
            ...rest: [
                ...parameter: Parameter<T, K>[],
                options: Readonly<{ crash: true }>,
            ],
        ): Effect<void, never, Exclude<T["services"], Entities>>;
    }

    Runs the operation's runner, and completes the operation with its message, as answer does. What the runner sends reaches the entities of the world, and each receiver handles its mailbox to its end before send returns. It fails the test when the work under pending is not an operation running in that incarnation.

    Type Declaration

      • (
            pending: Pending,
        ): Effect<"Delivered" | "Dropped", never, Exclude<T["services"], Entities>>
      • Parameters

        Returns Effect<"Delivered" | "Dropped", never, Exclude<T["services"], Entities>>

      • (
            pending: Pending,
            options: Readonly<{ crash: true }>,
        ): Effect<void, never, Exclude<T["services"], Entities>>
      • Runs the runner to its end, drops its message, and restarts the world: the process died between the replies the runner was given and the completion. The next run of the operation is given the stored replies.

        Parameters

        • pending: Pending
        • options: Readonly<{ crash: true }>

        Returns Effect<void, never, Exclude<T["services"], Entities>>

      • <K extends string>(
            key: K,
            ...parameter: Parameter<T, K>,
        ): Effect<"Delivered" | "Dropped", never, Exclude<T["services"], Entities>>
      • Runs the operation under way under key, and fails the test when there is none (decision 0186).

        Type Parameters

        • K extends string

        Parameters

        • key: K
        • ...parameter: Parameter<T, K>

        Returns Effect<"Delivered" | "Dropped", never, Exclude<T["services"], Entities>>

      • <K extends string>(
            key: K,
            ...rest: [
                ...parameter: Parameter<T, K>[],
                options: Readonly<{ crash: true }>,
            ],
        ): Effect<void, never, Exclude<T["services"], Entities>>
      • Type Parameters

        • K extends string

        Parameters

        • key: K
        • ...rest: [...parameter: Parameter<T, K>[], options: Readonly<{ crash: true }>]

        Returns Effect<void, never, Exclude<T["services"], Entities>>

    send: (
        message: T["inbound"],
        ...request: SentBy<T>,
    ) => Effect<Readonly<{ _tag: "Reused" }> | StoredReply<T["rejection"]>>

    Delivers an inbound message from a caller. Given a request id, it is a request the test names: a second send under the same sender and request id is a retry, given the reply stored for the first and not applied again, as the runtime answers it. The reply is kept for the whole rehearsal, a restart and a deploy included, as the runtime keeps one sent with keep: 'forever'. Without a request id, each send is a new request, whose reply no named request finds (decision 0200). A second send under the same sender and request id that carries another message is answered Reused, and is not applied (decision 0269). A program whose sender is null may leave the sender out, and the request with it (decision 0245).

    sendFrom: (
        message: T["inbound"],
        entity: Address,
    ) => Effect<StoredReply<T["rejection"]>>

    Delivers an inbound message from another entity's operation, as a new run of it (decision 0059). The entity need not exist: the test answers for it. Under the address of an entity of the world, the run is none of that entity's own, so each one's message is applied, and neither is answered the other's reply (decision 0262).

    state: Effect<T["state"]>

    The entity's state, as it stands after the last act of the test.

    underWay: <K extends string>(
        key: K,
        ...parameter: Parameter<T, K>,
    ) => Effect<PendingOf<T> | null>

    The work under way under key, as pending gives it, or null when there is none (decision 0186).