From 5c7c9cb70fa2de6dfcd92aebdb2f48b09bbd79e1 Mon Sep 17 00:00:00 2001 From: mjkwiatkowski Date: Sat, 4 Jul 2026 10:49:21 +0200 Subject: feat: added the database schema --- content/implementation.tex | 10 ++++++++-- sources/listing_schema.tex | 17 +++++++++++++++++ sources/listing_sinks.tex | 33 +++++++++++++++++++++++++++++++++ sources/listings.tex | 33 --------------------------------- style/style.tex | 2 +- 5 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 sources/listing_schema.tex create mode 100644 sources/listing_sinks.tex delete mode 100644 sources/listings.tex diff --git a/content/implementation.tex b/content/implementation.tex index d5dd5c1..e2fd23a 100644 --- a/content/implementation.tex +++ b/content/implementation.tex @@ -56,8 +56,14 @@ For a specific overview of advantages of \code{OpenDC} and a thorough comparison \end{figure} \section{Data Flow}\label{ss:data_flow} -\input{sources/listings.tex} -\ipsum[1-2] +\input{sources/listing_sinks.tex} + + +\ipsum[1-4] +\begin{figure}[t] + \input{sources/listing_schema.tex} +\end{figure} + diff --git a/sources/listing_schema.tex b/sources/listing_schema.tex new file mode 100644 index 0000000..c3130d6 --- /dev/null +++ b/sources/listing_schema.tex @@ -0,0 +1,17 @@ +\begin{lstlisting}[caption=The Redis and PostgreSQL schema (\texttt{schema.proto} file)., label={lst:protobuf-schema}] +syntax = "proto3"; + +package proto; + +option java_package = "org.opendc.common"; +option java_outer_classname = "ProtobufMetrics"; + +message ProtoExport { + string timestamp = 1; + string host_id = 2; + int32 tasksactive = 3; + double cpuutilization = 4; + double energyusage = 5; + double uptime = 6; + double downtime = 7; +}\end{lstlisting} diff --git a/sources/listing_sinks.tex b/sources/listing_sinks.tex new file mode 100644 index 0000000..89cf05a --- /dev/null +++ b/sources/listing_sinks.tex @@ -0,0 +1,33 @@ +\begin{minipage}[b]{0.48\textwidth} + \begin{lstlisting}[caption=Kafka PostgreSQL sink., label={lst:postgresql-sink}] +name=postgresql-sink +connector.class=io.confluent.connect.jdbc.JdbcSinkConnector +tasks.max=1 +key.converter=org.apache.kafka.connect.storage.StringConverter +value.converter=io.confluent.connect.protobuf.ProtobufConverter +value.converter.schema.registry.url=http://localhost:8081 +topics=postgres_topic +connection.url=jdbc:postgresql://127.0.0.1:5432/opendc +connection.user=matt +connection.password=admin +auto.create=true +auto.evolve=true +insert.mode=insert +table.name.format=postgres_topic\end{lstlisting} +\end{minipage} +\hspace{0.3cm} +\begin{minipage}[b]{0.48\textwidth} + \begin{lstlisting}[caption=Kafka Redis sink., label={lst:redis-sink}] +name=kafka-connect-redis +topics=postgres_topic +tasks.max=1 +connector.class=com.redis.kafka.connect.RedisSinkConnector +key.converter=org.apache.kafka.connect.storage.StringConverter +value.converter=io.confluent.connect.protobuf.ProtobufConverter +value.converter.schema.registry.url=http://localhost:8081 +transforms=downtime +transforms.downtime.type=io.confluent.connect.transforms.Filter$Value +transforms.downtime.filter.condition=$[?(@.downtime == '0.0')] +transforms.downtime.filter.type=exclude +transforms.downtime.missing.or.null.behavior=fail\end{lstlisting} +\end{minipage} diff --git a/sources/listings.tex b/sources/listings.tex deleted file mode 100644 index 89cf05a..0000000 --- a/sources/listings.tex +++ /dev/null @@ -1,33 +0,0 @@ -\begin{minipage}[b]{0.48\textwidth} - \begin{lstlisting}[caption=Kafka PostgreSQL sink., label={lst:postgresql-sink}] -name=postgresql-sink -connector.class=io.confluent.connect.jdbc.JdbcSinkConnector -tasks.max=1 -key.converter=org.apache.kafka.connect.storage.StringConverter -value.converter=io.confluent.connect.protobuf.ProtobufConverter -value.converter.schema.registry.url=http://localhost:8081 -topics=postgres_topic -connection.url=jdbc:postgresql://127.0.0.1:5432/opendc -connection.user=matt -connection.password=admin -auto.create=true -auto.evolve=true -insert.mode=insert -table.name.format=postgres_topic\end{lstlisting} -\end{minipage} -\hspace{0.3cm} -\begin{minipage}[b]{0.48\textwidth} - \begin{lstlisting}[caption=Kafka Redis sink., label={lst:redis-sink}] -name=kafka-connect-redis -topics=postgres_topic -tasks.max=1 -connector.class=com.redis.kafka.connect.RedisSinkConnector -key.converter=org.apache.kafka.connect.storage.StringConverter -value.converter=io.confluent.connect.protobuf.ProtobufConverter -value.converter.schema.registry.url=http://localhost:8081 -transforms=downtime -transforms.downtime.type=io.confluent.connect.transforms.Filter$Value -transforms.downtime.filter.condition=$[?(@.downtime == '0.0')] -transforms.downtime.filter.type=exclude -transforms.downtime.missing.or.null.behavior=fail\end{lstlisting} -\end{minipage} diff --git a/style/style.tex b/style/style.tex index f1b06a1..915e4a4 100644 --- a/style/style.tex +++ b/style/style.tex @@ -52,7 +52,7 @@ showspaces=false, showstringspaces=false, showtabs=false, - tabsize=2 + tabsize=2, } \lstset{style=mystyle} -- cgit v1.2.3