langchain.js
    Preparing search index...

    Interface DynamicBarrierValue<Value>

    A channel that switches between two states

    • in the "priming" state it can't be read from.
      • if it receives a WaitForNames update, it switches to the "waiting" state.
    • in the "waiting" state it collects named values until all are received.
      • once all named values are received, it can be read once, and it switches back to the "priming" state.
    interface DynamicBarrierValue<Value> {
        lc_graph_name: string;
        names?: Set<Value>;
        seen: Set<Value>;
        UpdateType: Value | WaitForNames<Value>;
        ValueType: void;
        checkpoint(): [undefined | Value[], Value[]];
        consume(): boolean;
        finish(): boolean;
        fromCheckpoint(
            checkpoint?: [undefined | Value[], Value[]],
        ): DynamicBarrierValue<Value>;
        get(): void;
        isAvailable(): boolean;
        update(values: (Value | WaitForNames<Value>)[]): boolean;
    }

    Type Parameters

    • Value
    Index

    Properties

    lc_graph_name: string = "DynamicBarrierValue"

    The name of the channel.

    names?: Set<Value>
    seen: Set<Value>
    UpdateType: Value | WaitForNames<Value>
    ValueType: void

    Methods

    • Return a string representation of the channel's current state.

      Returns [undefined | Value[], Value[]]

      if the channel is empty (never updated yet), or doesn't support checkpoints.

    • Mark the current value of the channel as consumed. By default, no-op. A channel can use this method to modify its state, preventing the value from being consumed again.

      Returns True if the channel was updated, False otherwise.

      Returns boolean

    • Notify the channel that the Pregel run is finishing. By default, no-op. A channel can use this method to modify its state, preventing finish.

      Returns True if the channel was updated, False otherwise.

      Returns boolean

    • Return a new identical channel, optionally initialized from a checkpoint. Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state.

      Parameters

      • Optionalcheckpoint: [undefined | Value[], Value[]]

      Returns DynamicBarrierValue<Value>

    • Return the current value of the channel.

      Returns void

      if the channel is empty (never updated yet).

    • Return True if the channel is available (not empty), False otherwise. Subclasses should override this method to provide a more efficient implementation than calling get() and catching EmptyChannelError.

      Returns boolean

    • Update the channel's value with the given sequence of updates. The order of the updates in the sequence is arbitrary. This method is called by Pregel for all channels at the end of each step. If there are no updates, it is called with an empty sequence.

      Raises InvalidUpdateError if the sequence of updates is invalid. Returns True if the channel was updated, False otherwise.

      Parameters

      Returns boolean

      if the sequence of updates is invalid.