Reaxive.Rx.Impl

Implements the Rx protocols and handles the contract.

Source

Summary

compose(observable, arg2)

Composes the internal action on received events with the given fun. The initial function to compose with is the identity function

compose(observable, fun, acc)
disconnect_all(state)

Internal function to disconnect from the sources

disconnect_source(state, src_id)

Internal function for disconnecting a single source. This function does not change anything beyond the sources field, in particular no decision about inactivating or even stopping the event sequence is taken

do_action(fun, event, accu, new_accu)

Internal function calculating the new value

do_subscribe(state, observer)

Internal function for subscribing a new observer

emit(impl, event)

Either emits a value or puts it into the queue

fun(observable, fun, acc \\ [])

This function sets the internal action on received events before the event is propagated to the subscribers. An initial accumulator value can also be provided

get_sources(observable)

All sources of Rx. Useful for debugging

handle_call(msg, from, state)

All request-reply calls for setting up the Rx

handle_cast(msg, state)

Asynchronous callback. Used for processing values and subscription

handle_event(state, event)

Internal function to handles the various events, in particular disconnects the source which is sending a on_completed

handle_value(state, value)

Internal function to handle new values, errors or completions. If state.action is :nil, the value is propagated without any modification

notify(arg1, state)

Internal function to notify subscribers, knows about ignoring notifies

on_completed(observer, observable)

The last regular message

on_error(observer, exception)

An error has occured, the pipeline will be aborted

on_next(observer, value)

Process the next value

on_subscribe(observable, on_subscribe)

Sets the on_subscribe function, which is called for the first subscription

source(observable, disposable)

Sets the disposable event sequence source. This is needed for proper unsubscribing from the source when terminating the sequence

start()

Starts the Rx Impl. If auto_stop is true, the Impl finishes after completion or after an error or after unsubscribing the last subscriber

start(name, options)
subscribe(observable, observer)

Subscribes a new observer. Returns a function for unsubscribing the observer

subscribers(observable)

All subscribers of Rx. Useful for debugging

terminate(reason, state)

Internal callback function at termination for clearing resources

terminate?(impl)

Internal predicate to check if we terminate ourselves

unsubscribe(observable, observer)

Unsubscribes an observer from the event sequence

Types

rx_propagate :: {:on_next, term} | {:on_error, term} | {:on_completed, nil | pid}

Internal message for propagating events.

reduce_tag :: :cont | :halt | :ignore

Tags for interacting between reduce-function and its reducers. They have the following implications:

  • :cont: continue with the iteration and send the current value to subscribers
  • :ignore: continue the iteration, but do not set anything to subscribers (i.e. ignore the value)
  • :halt: stop the iteration and send the current value to subscribers

reducer :: {reduce_tag, rx_propagate, term}

Return value of reducers

t :: %Reaxive.Rx.Impl{accu: term, action: term, active: term, name: term, on_subscribe: term, options: term, queue: term, sources: term, subscribers: term}

Functions

compose(observable, arg2)

Composes the internal action on received events with the given fun. The initial function to compose with is the identity function.

Source
compose(observable, fun, acc)
Source
disconnect_all(state)

Specs:

  • disconnect_all(t) :: t

Internal function to disconnect from the sources

Source
disconnect_source(state, src_id)

Specs:

  • disconnect_source(%Reaxive.Rx.Impl{accu: term, action: term, active: term, name: term, on_subscribe: term, options: term, queue: term, sources: term, subscribers: term}, any) :: %Reaxive.Rx.Impl{accu: term, action: term, active: term, name: term, on_subscribe: term, options: term, queue: term, sources: term, subscribers: term}

Internal function for disconnecting a single source. This function does not change anything beyond the sources field, in particular no decision about inactivating or even stopping the event sequence is taken.

Source
do_action(fun, event, accu, new_accu)

Specs:

Internal function calculating the new value

Source
do_subscribe(state, observer)

Internal function for subscribing a new observer

Source
emit(impl, event)

Specs:

Either emits a value or puts it into the queue

Source
fun(observable, fun, acc \\ [])

This function sets the internal action on received events before the event is propagated to the subscribers. An initial accumulator value can also be provided.

Source
get_sources(observable)

All sources of Rx. Useful for debugging.

Source
handle_call(msg, from, state)

All request-reply calls for setting up the Rx.

Source
handle_cast(msg, state)

Asynchronous callback. Used for processing values and subscription.

Source
handle_event(state, event)

Specs:

Internal function to handles the various events, in particular disconnects the source which is sending a on_completed.

Source
handle_value(state, value)

Specs:

Internal function to handle new values, errors or completions. If state.action is :nil, the value is propagated without any modification.

Source
notify(arg1, state)

Specs:

Internal function to notify subscribers, knows about ignoring notifies.

Source
on_completed(observer, observable)

The last regular message

Source
on_error(observer, exception)

An error has occured, the pipeline will be aborted.

Source
on_next(observer, value)

Process the next value

Source
on_subscribe(observable, on_subscribe)

Sets the on_subscribe function, which is called for the first subscription.

Source
source(observable, disposable)

Sets the disposable event sequence source. This is needed for proper unsubscribing from the source when terminating the sequence.

Source
start()

Starts the Rx Impl. If auto_stop is true, the Impl finishes after completion or after an error or after unsubscribing the last subscriber.

Source
start(name, options)
Source
subscribe(observable, observer)

Specs:

Subscribes a new observer. Returns a function for unsubscribing the observer.

Fails grafecully with an on_error message to the observer, if the observable is not or no longer available. In this case, an do-nothing unsubciption functions is returned (since no subscription has occured in the first place).

Source
subscribers(observable)

All subscribers of Rx. Useful for debugging.

Source
terminate(reason, state)

Internal callback function at termination for clearing resources

Source
terminate?(impl)

Internal predicate to check if we terminate ourselves.

Source
unsubscribe(observable, observer)

Unsubscribes an observer from the event sequence.

Source