diff --git a/constants/constants.go b/constants/constants.go index 0eb338ab..007902b0 100644 --- a/constants/constants.go +++ b/constants/constants.go @@ -40,5 +40,17 @@ const ( MySQL DriverType = "mysql" Oracle DriverType = "oracle" ) +// GlobalStateSupportedDrivers is the canonical list of connectors that support GLOBAL state +var GlobalStateSupportedDrivers = []DriverType{Postgres, MySQL} +// IsGlobalStateSupported reports whether the given connector type supports GLOBAL state +func IsGlobalStateSupported(connectorType string) bool { + dt := DriverType(connectorType) + for _, d := range GlobalStateSupportedDrivers { + if d == dt { + return true + } + } + return false +} var RelationalDrivers = []DriverType{Postgres, MySQL, Oracle} diff --git a/types/catalog.go b/types/catalog.go index 9e4c53c9..95a92df0 100644 --- a/types/catalog.go +++ b/types/catalog.go @@ -208,7 +208,8 @@ func GetStreamsDelta(oldStreams, newStreams *Catalog, connectorType string) *Cat // flag for connector which have global state support // TODO: create an array of global state supported connectors in constants - globalStateSupportedConnector := connectorType == string(constants.Postgres) || connectorType == string(constants.MySQL) + // flag for connectors which have global state support (centralized in constants) + globalStateSupportedConnector := constants.IsGlobalStateSupported(connectorType) for namespace, newMetadatas := range newStreams.SelectedStreams { for _, newMetadata := range newMetadatas {