Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions constants/constants.go
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR must be made from staging, not master. Please read the contribution docs at olake.io/docs

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this function from constants.go. constants.go is static page which should have no computation based methods.

dt := DriverType(connectorType)
for _, d := range GlobalStateSupportedDrivers {
if d == dt {
return true
}
}
return false
}
var RelationalDrivers = []DriverType{Postgres, MySQL, Oracle}
3 changes: 2 additions & 1 deletion types/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you are calling a loop to check the bool. but previously it was a simple OR. this is bit overkill I believe. please do change accordingly. try to use OR itself.


for namespace, newMetadatas := range newStreams.SelectedStreams {
for _, newMetadata := range newMetadatas {
Expand Down