@@ -3,7 +3,6 @@ package se.kth.cda.compiler.dataflow
3
3
import se .kth .cda .arc .syntaxtree .AST .Expr
4
4
import se .kth .cda .arc .syntaxtree .Type
5
5
import se .kth .cda .compiler .dataflow .ChannelStrategy ._
6
- import se .kth .cda .compiler .dataflow .DFG .newId
7
6
import se .kth .cda .compiler .dataflow .SinkKind .Debug
8
7
import se .kth .cda .compiler .dataflow .SourceKind .Socket
9
8
import se .kth .cda .compiler .dataflow .TimeKind .Ingestion
@@ -28,17 +27,11 @@ import se.kth.cda.compiler.dataflow.WindowKind.All
28
27
// val trace: Option[Trace] = None
29
28
// val scope: Option[Scope] = None
30
29
// }
30
+ trait Trace
31
31
32
- object DFG {
33
- var idCounter = 0
34
- def newId : Int = {
35
- val id = idCounter
36
- idCounter += 1
37
- id
38
- }
39
- }
32
+ final case class Metadata (nodes : List [Node ], timestamp_extractor : Int , arc_code : String )
40
33
41
- object Node {
34
+ object DFG {
42
35
var idCounter = 0
43
36
def newId : Int = {
44
37
val id = idCounter
@@ -56,23 +49,65 @@ object Channel {
56
49
}
57
50
}
58
51
59
- trait Trace
60
-
61
- final case class DFG (id : String = s " dfg ${DFG .newId}" , var nodes : List [Node ], target : String = " x86-64-unknown-linux-gnu" )
52
+ final case class DFG (id : String = s " dfg ${DFG .newId}" ,
53
+ var timestamp_extractor : Int = 1 ,
54
+ var nodes : List [Node ],
55
+ target : String = " x86-64-unknown-linux-gnu" )
62
56
63
57
// case class Scope(depth: Long, parent: Option[Scope]) extends Id
64
58
65
- final case class Node (var id : String = s " node ${ Node .newId} " , parallelism : Long = 1 , kind : NodeKind )
59
+ final case class Node (var id : String , parallelism : Long = 1 , kind : NodeKind )
66
60
67
61
sealed trait NodeKind
68
62
69
63
object NodeKind {
70
- final case class Source (sourceType : Type ,
64
+ object Task {
65
+ var idCounter = 0
66
+ def newId : Int = {
67
+ val id = idCounter
68
+ idCounter += 1
69
+ id
70
+ }
71
+ }
72
+
73
+ object Source {
74
+ var idCounter = 0
75
+ def newId : Int = {
76
+ val id = idCounter
77
+ idCounter += 1
78
+ id
79
+ }
80
+ }
81
+
82
+ object Sink {
83
+ var idCounter = 0
84
+ def newId : Int = {
85
+ val id = idCounter
86
+ idCounter += 1
87
+ id
88
+ }
89
+ }
90
+
91
+ object Window {
92
+ var idCounter = 0
93
+ def newId : Int = {
94
+ val id = idCounter
95
+ idCounter += 1
96
+ id
97
+ }
98
+ }
99
+
100
+ final case class Source (sourceType : Type = null ,
101
+ var format : Format = null ,
71
102
channelStrategy : ChannelStrategy = Forward ,
72
103
var successors : Vector [ChannelKind ] = Vector .empty,
73
- kind : SourceKind = Socket (" localhost" , 1337 ))
104
+ var kind : SourceKind = null )
105
+ extends NodeKind
106
+ final case class Sink (sinkType : Type = null ,
107
+ var format : Format = null ,
108
+ var predecessor : Node = null ,
109
+ var kind : SinkKind = null )
74
110
extends NodeKind
75
- final case class Sink (sinkType : Type , var predecessor : Node = null , kind : SinkKind = Debug ) extends NodeKind
76
111
final case class Task (var weldFunc : Expr ,
77
112
inputType : Type ,
78
113
outputType : Type ,
@@ -92,7 +127,12 @@ object NodeKind {
92
127
extends NodeKind
93
128
}
94
129
95
- final case class WindowFunction (inputType : Type , outputType : Type , builderType : Type , init : Expr , lift : Expr , lower : Expr )
130
+ final case class WindowFunction (inputType : Type ,
131
+ outputType : Type ,
132
+ builderType : Type ,
133
+ init : Expr ,
134
+ lift : Expr ,
135
+ lower : Expr )
96
136
97
137
sealed trait ChannelKind
98
138
@@ -104,13 +144,24 @@ object ChannelKind {
104
144
sealed trait SourceKind
105
145
106
146
object SourceKind {
107
- final case class Socket (host : String , port : Long ) extends SourceKind
147
+ final case class Socket (var host : String , var port : Long ) extends SourceKind
148
+ final case class LocalFile (var path : String ) extends SourceKind
108
149
}
109
150
110
151
sealed trait SinkKind
111
152
112
153
object SinkKind {
113
154
final case object Debug extends SinkKind
155
+ final case class Socket (var host : String , var port : Long ) extends SinkKind
156
+ final case class LocalFile (var path : String ) extends SinkKind
157
+ }
158
+
159
+ sealed trait Format
160
+
161
+ object Format {
162
+ final case object JSON extends Format
163
+ final case object CSV extends Format
164
+ final case object UTF8 extends Format
114
165
}
115
166
116
167
sealed trait TaskKind
0 commit comments