klesh commented on code in PR #3151: URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r999439811
########## plugins/core/tap/singer_impl.go: ########## @@ -0,0 +1,196 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tap + +import ( + "bufio" + "encoding/json" + "github.com/apache/incubator-devlake/config" + "github.com/apache/incubator-devlake/errors" + "github.com/mitchellh/hashstructure" + "os" + "os/exec" + "path/filepath" +) + +type ( + SingerTapImpl struct { + *SingerTapConfig + cmd string + name string + tempLocation string + propertiesFile *fileData[SingerTapProperties] + stateFile *fileData[[]byte] + configFile *fileData[[]byte] + } + fileData[Content any] struct { + path string + content *Content + } +) + +func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) { Review Comment: The one located in the project root folder, there are 2 implementations already, `dalgorm` and `migration`. They both implemented the `interfaces` defined in `core` package. In this way, we can separate the contract from the concrete implementation, which helps us avoid importing 3rd libraries directly into our system and writing test cases among other benefits. Generic or not doesn't matter, we don't plan to implement another specific `migration` or `dal` as well. Come to think about it, maybe `helpers/pluginhelper/tap` is a more appropriate place to be. I think the whole `singer` feature is not the `core` of our system, it is sth we offer to developers, they could choose to use RESTful API or use `singer`, so, no, they should not be in the `core` package. Take a look at the `plugins/helper` which contains all RESTFul helpers we offer for plugin developers, it was put into a separate package apart from the `core` package as an optional feature. I think the `singer` should do the same, except the existing `plugins/helper` will be moved to `helpers/pluginhelper/restful` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
