# HG changeset patch # User František Kučera # Date 1578762418 -3600 # Node ID 03cd058c33bab64159ba0f1f00062fa1f3033712 # Parent dace11211dc964d99fdf75e8552084b25a3c3544 rename exec to streamlet diff -r dace11211dc9 -r 03cd058c33ba .hgignore --- a/.hgignore Sat Jan 11 01:02:01 2020 +0100 +++ b/.hgignore Sat Jan 11 18:06:58 2020 +0100 @@ -5,5 +5,5 @@ syntax: regexp -^exec/protocol\.(pdf|png|svg) -^exec/ExecMsg\.(h) +^streamlet/protocol\.(pdf|png|svg) +^streamlet/StreamletMsg\.(h|envelope\.h) diff -r dace11211dc9 -r 03cd058c33ba exec/Makefile --- a/exec/Makefile Sat Jan 11 01:02:01 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -.PHONY: all display display-messages display-protocol constants - -all: protocol.pdf constants - -protocol.pdf: messages.csv protocol.csv protocol.sh - ./protocol.sh - -display: display-messages display-protocol - -display-messages: - cat messages.csv | relpipe-in-csv "messages" | relpipe-out-tabular - -display-protocol: - cat protocol.csv | relpipe-in-csv "protocol" | relpipe-out-tabular - -constants: ExecMsg.h - -ExecMsg.h: messages.csv constants.cpp.sh - cat messages.csv | ./constants.cpp.sh > ExecMsg.h - g++ ExecMsg.h - rm ExecMsg.h.gch - -clean: - rm -f protocol.pdf - rm -f ExecMsg.h diff -r dace11211dc9 -r 03cd058c33ba exec/constants.cpp.sh --- a/exec/constants.cpp.sh Sat Jan 11 01:02:01 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#!/bin/bash - -CSV="$(cat)"; - -echo "// This file was generated from the specification. - -#include -#include - -namespace relpipe { -namespace in { -namespace filesystem { - -class ExecMsg { -public: -"; - -echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' static const int ' || message || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo - -echo " - static std::map getMessageNames() { - std::map m; -"; - -echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' m[' || message || '] = L\"' || message || '\";' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo - -echo " - return m; - } - -}; -" - -echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT 'const int ExecMsg::' || message || ' = ' || code || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo - -echo " -} -} -}"; \ No newline at end of file diff -r dace11211dc9 -r 03cd058c33ba exec/messages.csv --- a/exec/messages.csv Sat Jan 11 01:02:01 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -code,message,sender,parameter_1,parameter_2,parameter_3,parameter_4 -100,VERSION_SUPPORTED,executor,version,,, -101,WAITING_FOR_VERSION,executor,,,, -102,VERSION_ACCEPTED,process,version,,, -103,RELATION_START,executor,name,,, -104,INPUT_ATTRIBUTE_METADATA,executor,name,type,, -105,OUTPUT_ATTRIBUTE_ALIAS,executor,name,,, -106,OPTION,executor,name,type,value, -107,COMPLETION_REQUEST,executor,what,value,, -108,COMPLETION,process,value,,, -109,COMPLETION_END,process,,,, -110,WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA,executor,,,, -111,OUTPUT_ATTRIBUTE_METADATA,process,name,type,, -112,WAITING_FOR_INPUT_ATTRIBUTES,process,,,, -113,INPUT_ATTRIBUTE,executor,index,value,isNull, -114,WAITING_FOR_OUTPUT_ATTRIBUTES,executor,,,, -115,OUTPUT_ATTRIBUTE,process,value,isNull,, -116,EXECUTOR_ERROR,executor,code,message,, -117,PROCESS_ERROR,process,code,message,, -118,PROCESS_WARNING,process,code,message,, -120,RELATION_END,executor,,,, -0,any_process,process,,,, -0,any_executor,executor,,,, diff -r dace11211dc9 -r 03cd058c33ba exec/protocol.csv --- a/exec/protocol.csv Sat Jan 11 01:02:01 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -from,to,label -start,VERSION_SUPPORTED, -VERSION_SUPPORTED,WAITING_FOR_VERSION, -VERSION_SUPPORTED,VERSION_SUPPORTED,+ -WAITING_FOR_VERSION,VERSION_ACCEPTED, -VERSION_ACCEPTED,RELATION_START, -RELATION_START,INPUT_ATTRIBUTE_METADATA, -INPUT_ATTRIBUTE_METADATA,INPUT_ATTRIBUTE_METADATA,* -INPUT_ATTRIBUTE_METADATA,OUTPUT_ATTRIBUTE_ALIAS, -OUTPUT_ATTRIBUTE_ALIAS,OUTPUT_ATTRIBUTE_ALIAS,* -OUTPUT_ATTRIBUTE_ALIAS,OPTION, -OPTION,OPTION,* -OPTION,WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA, -OPTION,COMPLETION_REQUEST, -COMPLETION_REQUEST,COMPLETION, -COMPLETION,COMPLETION,* -COMPLETION,COMPLETION_END, -COMPLETION_END,end, -WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA,OUTPUT_ATTRIBUTE_METADATA, -OUTPUT_ATTRIBUTE_METADATA,OUTPUT_ATTRIBUTE_METADATA,* -OUTPUT_ATTRIBUTE_METADATA,WAITING_FOR_INPUT_ATTRIBUTES, -WAITING_FOR_INPUT_ATTRIBUTES,RELATION_END, -WAITING_FOR_INPUT_ATTRIBUTES,INPUT_ATTRIBUTE, -INPUT_ATTRIBUTE,INPUT_ATTRIBUTE,* -INPUT_ATTRIBUTE,WAITING_FOR_OUTPUT_ATTRIBUTES, -WAITING_FOR_OUTPUT_ATTRIBUTES,OUTPUT_ATTRIBUTE, -OUTPUT_ATTRIBUTE,OUTPUT_ATTRIBUTE,* -OUTPUT_ATTRIBUTE,WAITING_FOR_INPUT_ATTRIBUTES, -RELATION_END,end, -any_process,EXECUTOR_ERROR, -any_executor,PROCESS_ERROR, -any_executor,PROCESS_WARNING, diff -r dace11211dc9 -r 03cd058c33ba exec/protocol.sh --- a/exec/protocol.sh Sat Jan 11 01:02:01 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -#!/bin/bash - -read_nullbyte() { for v in "$@"; do export "$v"; read -r -d '' "$v"; done } - -# Warning: this script is unsafe and certain characters (which are perfectly legal in CSV values) might cause invalid DOT (GraphViz) streams. (you have been warned) - -nodes() { - cat messages.csv \ - | relpipe-in-csv \ - | relpipe-tr-cut '.*' 'message|sender' \ - | relpipe-tr-sed '.*' 'sender' 'executor' 'coral' \ - | relpipe-tr-sed '.*' 'sender' 'process' 'gold2' \ - | relpipe-out-nullbyte \ - | while read_nullbyte message color; do echo "$message[style=\"filled,rounded\", fillcolor=$color];"; done - echo; -} - -edges() { - cat protocol.csv \ - | relpipe-in-csv \ - | relpipe-out-nullbyte \ - | while read_nullbyte from to label; do echo "$from -> $to [label=\" $label\"];"; done -} - -header() { - echo "digraph G { -#rankdir=LR; -node[shape=box, style=rounded, fontname=Ubuntu]; -start[shape=doublecircle]; -end[shape=doublecircle]; -"; -} - -footer() { - echo "}"; -} - -( header; nodes; edges; footer ) | dot -Tpdf > protocol.pdf diff -r dace11211dc9 -r 03cd058c33ba exec/protocol.txt --- a/exec/protocol.txt Sat Jan 11 01:02:01 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -messages.csv: - - list of message types and their parameters - -protocol.csv: - - list of allowed responses / interactions - - label + = message can repeat but will be sent at least once - - label * = message can repeat but can be also completely skipped - - error message can be sent as a response to any message and terminates the process - - warning message can be sent as a response to any message, but does not affect the workflow (just causes e.g. printing a warning to STDERR) diff -r dace11211dc9 -r 03cd058c33ba streamlet/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/streamlet/Makefile Sat Jan 11 18:06:58 2020 +0100 @@ -0,0 +1,27 @@ +.PHONY: all display display-messages display-protocol constants + +all: protocol.pdf constants + +protocol.pdf: messages.csv protocol.csv protocol.sh + ./protocol.sh + +display: display-messages display-protocol + +display-messages: + cat messages.csv | relpipe-in-csv "messages" | relpipe-out-tabular + +display-protocol: + cat protocol.csv | relpipe-in-csv "protocol" | relpipe-out-tabular + +constants: StreamletMsg.h + +StreamletMsg.h: messages.csv constants.cpp.sh + cat messages.csv | ./constants.cpp.sh > StreamletMsg.h + echo '#include "StreamletMsg.h"' > StreamletMsg.envelope.h + g++ StreamletMsg.envelope.h + rm StreamletMsg.envelope.h + rm StreamletMsg.envelope.h.gch + +clean: + rm -f protocol.pdf + rm -f StreamletMsg.h diff -r dace11211dc9 -r 03cd058c33ba streamlet/constants.cpp.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/streamlet/constants.cpp.sh Sat Jan 11 18:06:58 2020 +0100 @@ -0,0 +1,41 @@ +#!/bin/bash + +CSV="$(cat)"; + +echo "// This file was generated from the specification. + +#pragma once + +#include +#include + +namespace relpipe { +namespace in { +namespace filesystem { + +class StreamletMsg { +public: +"; + +echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' static const int ' || message || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo + +echo " + static std::map getMessageNames() { + std::map m; +"; + +echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' m[' || message || '] = L\"' || message || '\";' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo + +echo " + return m; + } + +}; +" + +echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT 'const int StreamletMsg::' || message || ' = ' || code || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo + +echo " +} +} +}"; diff -r dace11211dc9 -r 03cd058c33ba streamlet/messages.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/streamlet/messages.csv Sat Jan 11 18:06:58 2020 +0100 @@ -0,0 +1,23 @@ +code,message,sender,parameter_1,parameter_2,parameter_3,parameter_4 +100,VERSION_SUPPORTED,executor,version,,, +101,WAITING_FOR_VERSION,executor,,,, +102,VERSION_ACCEPTED,streamlet,version,,, +103,RELATION_START,executor,name,,, +104,INPUT_ATTRIBUTE_METADATA,executor,name,type,, +105,OUTPUT_ATTRIBUTE_ALIAS,executor,name,,, +106,OPTION,executor,name,type,value, +107,COMPLETION_REQUEST,executor,what,value,, +108,COMPLETION,streamlet,value,,, +109,COMPLETION_END,streamlet,,,, +110,WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA,executor,,,, +111,OUTPUT_ATTRIBUTE_METADATA,streamlet,name,type,, +112,WAITING_FOR_INPUT_ATTRIBUTES,streamlet,,,, +113,INPUT_ATTRIBUTE,executor,index,value,isNull, +114,WAITING_FOR_OUTPUT_ATTRIBUTES,executor,,,, +115,OUTPUT_ATTRIBUTE,streamlet,value,isNull,, +116,EXECUTOR_ERROR,executor,code,message,, +117,STREAMLET_ERROR,streamlet,code,message,, +118,STREAMLET_WARNING,streamlet,code,message,, +120,RELATION_END,executor,,,, +0,any_streamlet,streamlet,,,, +0,any_executor,executor,,,, diff -r dace11211dc9 -r 03cd058c33ba streamlet/protocol.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/streamlet/protocol.csv Sat Jan 11 18:06:58 2020 +0100 @@ -0,0 +1,32 @@ +from,to,label +start,VERSION_SUPPORTED, +VERSION_SUPPORTED,WAITING_FOR_VERSION, +VERSION_SUPPORTED,VERSION_SUPPORTED,+ +WAITING_FOR_VERSION,VERSION_ACCEPTED, +VERSION_ACCEPTED,RELATION_START, +RELATION_START,INPUT_ATTRIBUTE_METADATA, +INPUT_ATTRIBUTE_METADATA,INPUT_ATTRIBUTE_METADATA,* +INPUT_ATTRIBUTE_METADATA,OUTPUT_ATTRIBUTE_ALIAS, +OUTPUT_ATTRIBUTE_ALIAS,OUTPUT_ATTRIBUTE_ALIAS,* +OUTPUT_ATTRIBUTE_ALIAS,OPTION, +OPTION,OPTION,* +OPTION,WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA, +OPTION,COMPLETION_REQUEST, +COMPLETION_REQUEST,COMPLETION, +COMPLETION,COMPLETION,* +COMPLETION,COMPLETION_END, +COMPLETION_END,end, +WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA,OUTPUT_ATTRIBUTE_METADATA, +OUTPUT_ATTRIBUTE_METADATA,OUTPUT_ATTRIBUTE_METADATA,* +OUTPUT_ATTRIBUTE_METADATA,WAITING_FOR_INPUT_ATTRIBUTES, +WAITING_FOR_INPUT_ATTRIBUTES,RELATION_END, +WAITING_FOR_INPUT_ATTRIBUTES,INPUT_ATTRIBUTE, +INPUT_ATTRIBUTE,INPUT_ATTRIBUTE,* +INPUT_ATTRIBUTE,WAITING_FOR_OUTPUT_ATTRIBUTES, +WAITING_FOR_OUTPUT_ATTRIBUTES,OUTPUT_ATTRIBUTE, +OUTPUT_ATTRIBUTE,OUTPUT_ATTRIBUTE,* +OUTPUT_ATTRIBUTE,WAITING_FOR_INPUT_ATTRIBUTES, +RELATION_END,end, +any_streamlet,EXECUTOR_ERROR, +any_executor,STREAMLET_ERROR, +any_executor,STREAMLET_WARNING, diff -r dace11211dc9 -r 03cd058c33ba streamlet/protocol.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/streamlet/protocol.sh Sat Jan 11 18:06:58 2020 +0100 @@ -0,0 +1,38 @@ +#!/bin/bash + +read_nullbyte() { for v in "$@"; do export "$v"; read -r -d '' "$v"; done } + +# Warning: this script is unsafe and certain characters (which are perfectly legal in CSV values) might cause invalid DOT (GraphViz) streams. (you have been warned) + +nodes() { + cat messages.csv \ + | relpipe-in-csv \ + | relpipe-tr-cut '.*' 'message|sender' \ + | relpipe-tr-sed '.*' 'sender' 'executor' 'coral' \ + | relpipe-tr-sed '.*' 'sender' 'streamlet' 'gold2' \ + | relpipe-out-nullbyte \ + | while read_nullbyte message color; do echo "$message[style=\"filled,rounded\", fillcolor=$color];"; done + echo; +} + +edges() { + cat protocol.csv \ + | relpipe-in-csv \ + | relpipe-out-nullbyte \ + | while read_nullbyte from to label; do echo "$from -> $to [label=\" $label\"];"; done +} + +header() { + echo "digraph G { +#rankdir=LR; +node[shape=box, style=rounded, fontname=Ubuntu]; +start[shape=doublecircle]; +end[shape=doublecircle]; +"; +} + +footer() { + echo "}"; +} + +( header; nodes; edges; footer ) | dot -Tpdf > protocol.pdf diff -r dace11211dc9 -r 03cd058c33ba streamlet/protocol.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/streamlet/protocol.txt Sat Jan 11 18:06:58 2020 +0100 @@ -0,0 +1,9 @@ +messages.csv: + - list of message types and their parameters + +protocol.csv: + - list of allowed responses / interactions + - label + = message can repeat but will be sent at least once + - label * = message can repeat but can be also completely skipped + - error message can be sent as a response to any message and terminates the streamlet process + - warning message can be sent as a response to any message, but does not affect the workflow (just causes e.g. printing a warning to STDERR)