@flux-control/effect-modbus-rs
    Preparing search index...

    Interface ReadDebouncer

    A collection point for reads that arrive separately.

    interface ReadDebouncer {
        flush: Effect<void>;
        pending: number;
        read(address: number): Effect<number, ModbusError>;
        readAll(
            addresses: readonly number[],
        ): Effect<readonly number[], ModbusError>;
        readAllNow(
            addresses: readonly number[],
        ): Effect<readonly number[], ModbusError>;
        readNow(address: number): Effect<number, ModbusError>;
    }
    Index
    flush: Effect<void>

    Reads whatever is collected, now.

    Never fails: the outcome goes to the readers waiting on the batch, not to whoever asked for the flush.

    pending: number

    Addresses currently collected. Intended for tests.

    • Collects several addresses for the window, as one reader, and returns their values in the order asked for.

      A reader that already holds every address does not need a collection point, only a planner. With a window of zero the group is planned and read at once, so a caller of this method gets one transaction per span with no debouncer at all.

      Parameters

      • addresses: readonly number[]

      Returns Effect<readonly number[], ModbusError>

    • Adds several addresses to the batch and reads immediately.

      Parameters

      • addresses: readonly number[]

      Returns Effect<readonly number[], ModbusError>

    • Adds an address to the batch and reads immediately, rather than waiting.

      The flush includes readers already collected. Its plan can require several transactions, and their results are delivered to the waiting readers.

      Parameters

      • address: number

      Returns Effect<number, ModbusError>