Module kfnode

kfnode is a meta-behavior that all parts of the pipe, such as buffers and demultiplexors, are build upon.

Copyright © 2019 Klarna Bank AB (publ)

Behaviours: gen_statem.

This module defines the kfnode behaviour.
Required callback functions: init/2, handle_message/3, handle_flush/2, terminate/2.

Description

kfnode is a meta-behavior that all parts of the pipe, such as buffers and demultiplexors, are build upon. This module implements the following common actions:

Note: this is an internal behavior, it shouldn't be used directly

State transition diagram

           initial
              |
              v
      ?ack    |  ?feed
      +-->--ready -->--+
      |       |        |
      |       v        |
      ^    exiting     v
      |                |
   blocked ---<---- working
           ?done

Message sequence diagrams

Handle message from the upstream

This is a normal workflow as seen from the perspective of a kfnode.

Data Types

message()

message() = #kflow_msg{}

Function Index

feed/3Send message to the kfnode and block the caller until the message is processed by this node (but the subsequent processing is done asynchronously).
get_status/1Get various debug information about the node.
post_init/2Tell the node about its neighbours.
start_link/1

Function Details

feed/3

feed(Pid::pid(), Msg::message(), Timeout::timeout()) -> ok | {error, term()}

Send message to the kfnode and block the caller until the message is processed by this node (but the subsequent processing is done asynchronously)

get_status/1

get_status(Pid::pid()) -> term()

Get various debug information about the node

post_init/2

post_init(Pid::pid(), Neighbors::{_Upstream::pid(), _Downstream::pid()}) -> ok

Tell the node about its neighbours

start_link/1

start_link(Init_data::#init_data{}) -> {ok, pid()}


Generated by EDoc