remove streamType field

This commit is contained in:
Felix Kunde
2021-09-22 11:47:31 +02:00
parent a17d63088b
commit 223ffa75ef
10 changed files with 40 additions and 96 deletions
+6 -20
View File
@@ -150,23 +150,9 @@ func (c *Cluster) getEventStreamSource(stream acidv1.Stream, table, eventType st
}
func getEventStreamFlow(stream acidv1.Stream) zalandov1alpha1.EventStreamFlow {
switch stream.StreamType {
case "nakadi":
return zalandov1alpha1.EventStreamFlow{
Type: constants.EventStreamFlowPgNakadiType,
DataTypeColumn: constants.EventStreamFlowDataTypeColumn,
DataOpColumn: constants.EventStreamFlowDataOpColumn,
MetadataColumn: constants.EventStreamFlowMetadataColumn,
DataColumn: constants.EventStreamFlowDataColumn,
}
case "wal":
return zalandov1alpha1.EventStreamFlow{
Type: constants.EventStreamFlowPgGenericType,
PayloadColumn: constants.EventStreamFlowPayloadColumn,
}
return zalandov1alpha1.EventStreamFlow{
Type: constants.EventStreamFlowPgGenericType,
}
return zalandov1alpha1.EventStreamFlow{}
}
func getEventStreamSink(stream acidv1.Stream, eventType string) zalandov1alpha1.EventStreamSink {
@@ -190,8 +176,7 @@ func getTableSchema(fullTableName string) (tableName, schemaName string) {
func getOutboxTable(tableName, eventType string) zalandov1alpha1.EventStreamTable {
return zalandov1alpha1.EventStreamTable{
Name: outboxTableNameTemplate.Format("table", tableName, "eventtype", eventType),
IDColumn: "id",
Name: outboxTableNameTemplate.Format("table", tableName, "eventtype", eventType),
}
}
@@ -236,15 +221,16 @@ func (c *Cluster) syncStreams() error {
c.logger.Infof("event streams do not exist, create it")
err := c.createStreams()
if err != nil {
return fmt.Errorf("event stream creation failed: %v", err)
return fmt.Errorf("event streams creation failed: %v", err)
}
} else {
desiredStreams := c.generateFabricEventStream()
if !reflect.DeepEqual(effectiveStreams.Spec, desiredStreams.Spec) {
c.logger.Debug("updating event streams")
desiredStreams.ObjectMeta.ResourceVersion = effectiveStreams.ObjectMeta.ResourceVersion
err = c.updateStreams(desiredStreams)
if err != nil {
return fmt.Errorf("event stream update failed: %v", err)
return fmt.Errorf("event streams update failed: %v", err)
}
}
}
+2 -12
View File
@@ -47,16 +47,7 @@ var (
},
Streams: []acidv1.Stream{
{
StreamType: "nakadi",
Database: "foo",
Tables: map[string]string{
"bar": "stream_type_a",
},
BatchSize: uint32(100),
},
{
StreamType: "wal",
Database: "foo",
Database: "foo",
Tables: map[string]string{
"bar": "stream_type_a",
},
@@ -132,8 +123,7 @@ func TestUpdateFabricEventStream(t *testing.T) {
var pgSpec acidv1.PostgresSpec
pgSpec.Streams = []acidv1.Stream{
{
StreamType: "nakadi",
Database: "foo",
Database: "foo",
Tables: map[string]string{
"bar": "stream_type_b",
},