Options
All
  • Public
  • Public/Protected
  • All
Menu

Library @swim/streamlet

Swim Streamlet Library

The Swim Streamlet library implements a streaming state machine framework. Streamlets are stateful application components that continuously consume input states from streaming inlets, and continuously produce output states on streaming outlets.

Overview

Streamlets defines a model for continuous stateful computations that consume many streaming input states, and produce many streaming output states. The streamlet model facilitates dynamic binding of streaming application components to their inputs and outputs, and provides a precise, rate decoupled, backpressure regulated, re-evaluation model for reconciling the state of streamlet components after their transitively dependent input states change.

Streamlets are general purpose programming constructs; they are not restricted to modelling pure, data parallel functions. Unlinke Spark RDDs, or Flink Datasets, Streamlets can encapsulate arbitrary streaming business logic. And unlike Reactive Streams, which are purely demand driven, Streamlets model both supply and demand signals, enabling significantly optimized subgraph re-evaluation when sets of input states change concurrently.

Inlets, Outlets, and Streamlets

The streamlet programming model introduces three key concepts: inlets, outlets, and streamlets.

  • Inlet – a consumer of state changes.
  • Outlet – a producer of state changes.
  • Streamlet – a stateful component with zero or more named input outlets, and zero or more named output inlets.

Additional derivative Inlet and Outlet types provide specialized interfaces for structured input and output states.

  • MapInlet – a consumer of keyed state changes, i.e. updates to a key-value map.
  • MapOutlet – a producer of keyed state changes, i.e. updates to a key-value map.

Combinators

Outlets, being sources of state, define functional combinators, such as map, filter, and reduce, that produce new, transformed outlets. The Streamlet model enables ultra efficient recomputation of combinators. The reduce combinator, for example, memoizes partial reduction products in a b-tree, enabling log-time updates to its reduced state when any given input key changes.

Index

Type aliases

FilterFieldsFunction

FilterFieldsFunction<K, V>: (key: K, value: V) => boolean

Type parameters

  • K

  • V

Type declaration

    • (key: K, value: V): boolean
    • Parameters

      • key: K
      • value: V

      Returns boolean

InletType

InletType: "value" | "map"

InoutletType

InoutletType: "value" | "map"

MapFieldValuesFunction

MapFieldValuesFunction<K, VI, VO>: (key: K, value: VI) => VO

Type parameters

  • K

  • VI

  • VO

Type declaration

    • (key: K, value: VI): VO
    • Parameters

      • key: K
      • value: VI

      Returns VO

MapValueFunction

MapValueFunction<I, O>: (value: I) => O

Type parameters

  • I

  • O

Type declaration

    • (value: I): O
    • Parameters

      • value: I

      Returns O

OutletType

OutletType: "value" | "map"

WatchFieldsFunction

WatchFieldsFunction<K, V>: (key: K, value: V) => void

Type parameters

  • K

  • V

Type declaration

    • (key: K, value: V): void
    • Parameters

      • key: K
      • value: V

      Returns void

WatchValueFunction

WatchValueFunction<I>: (value: I) => void

Type parameters

  • I

Type declaration

    • (value: I): void
    • Parameters

      • value: I

      Returns void

Variables

Inlet

Inlet: { is: any }

Type declaration

  • is: function
    • is<I>(object: unknown): object is Inlet<I>
    • Type parameters

      • I

      Parameters

      • object: unknown

      Returns object is Inlet<I>

MapInlet

MapInlet: { is: any }

Type declaration

  • is: function
    • is<K, V, I>(object: unknown): object is MapInlet<K, V, I>
    • Type parameters

      • K

      • V

      • I

      Parameters

      • object: unknown

      Returns object is MapInlet<K, V, I>

MapOutlet

MapOutlet: { is: any }

Type declaration

  • is: function
    • is<K, V, I>(object: unknown): object is MapOutlet<K, V, I>
    • Type parameters

      • K

      • V

      • I

      Parameters

      • object: unknown

      Returns object is MapOutlet<K, V, I>

MapOutletCombinators

MapOutletCombinators: { define: any; filter: any; map: any; memoize: any; reduce: any; watch: any }

Type declaration

  • define: function
    • Type parameters

      • K

      • V

      • O

      Parameters

      Returns void

  • filter: function
    • Type parameters

      • K_2

      • V_2

      • O_2

      Parameters

      Returns MapOutlet<K_2, V_2, Map<K_2, V_2>>

  • map: function
    • Type parameters

      • K_3

      • V_3

      • O_3

      • O2

      Parameters

      Returns Outlet<O2>

    • Type parameters

      • K_4

      • V_4

      • O_4

      • V2

      Parameters

      Returns MapOutlet<K_4, V2, Map<K_4, V2>>

  • memoize: function
    • memoize<K_1, V_1, O_1>(): MapOutlet<K_1, V_1, O_1>
    • Type parameters

      • K_1

      • V_1

      • O_1

      Returns MapOutlet<K_1, V_1, O_1>

  • reduce: function
    • reduce<K_5, V_5, O_5, U>(identity: U, accumulator: (result: U, element: V_5) => U, combiner: (result: U, result2: U) => U): Outlet<U>
    • Type parameters

      • K_5

      • V_5

      • O_5

      • U

      Parameters

      • identity: U
      • accumulator: (result: U, element: V_5) => U
          • (result: U, element: V_5): U
          • Parameters

            • result: U
            • element: V_5

            Returns U

      • combiner: (result: U, result2: U) => U
          • (result: U, result2: U): U
          • Parameters

            • result: U
            • result2: U

            Returns U

      Returns Outlet<U>

  • watch: function
    • Type parameters

      • K_6

      • V_6

      • O_6

      Parameters

      Returns MapOutlet<K_6, V_6, O_6>

    • Type parameters

      • K_7

      • V_7

      • O_7

      Parameters

      Returns MapOutlet<K_7, V_7, O_7>

Outlet

Outlet: { is: any }

Type declaration

  • is: function
    • is<O>(object: unknown): object is Outlet<O>
    • Type parameters

      • O

      Parameters

      • object: unknown

      Returns object is Outlet<O>

OutletCombinators

OutletCombinators: { define: any; map: any; memoize: any; watch: any }

Type declaration

  • define: function
    • Type parameters

      • O

      Parameters

      Returns void

  • map: function
    • Type parameters

      • O_2

      • O2

      Parameters

      Returns Outlet<O2>

  • memoize: function
    • Type parameters

      • O_1

      Returns Outlet<O_1>

  • watch: function
    • Type parameters

      • O_3

      Parameters

      Returns Outlet<O_3>

Streamlet

Streamlet: { is: any }

Type declaration

  • is: function
    • is<I, O>(object: unknown): object is Streamlet<I, O>
    • Type parameters

      • I

      • O

      Parameters

      • object: unknown

      Returns object is Streamlet<I, O>

StreamletScope

StreamletScope: { is: any }

Type declaration

  • is: function
    • Type parameters

      • O

      Parameters

      • object: unknown

      Returns object is StreamletScope<O>

Functions

In

  • In(name: string): PropertyDecorator
  • In(options: InletOptions): PropertyDecorator
  • In(target: unknown, key: string): void

Inout

  • Inout(name: string): PropertyDecorator
  • Inout(options: InoutletOptions): PropertyDecorator
  • Inout(target: unknown, key: string): void

Out

  • Out(name: string): PropertyDecorator
  • Out(options: OutletOptions): PropertyDecorator
  • Out(target: unknown, key: string): void

Generated using TypeDoc