Skip to content

Conversation

Wenne
Copy link

@Wenne Wenne commented May 10, 2023

支持 mysql 存储

Wenne added 2 commits May 9, 2023 11:52
* add gorm define to entity
* add store for mysql
* add keeper for mysql
@Wenne
Copy link
Author

Wenne commented May 10, 2023

@ShiningRush 大佬有空可以 review 一下

* add store for mysql
* add keeper for mysql
@ShiningRush
Copy link
Owner

好的,我周末看下,测试用例看起来有部分失败了,可以先修复下

@Wenne
Copy link
Author

Wenne commented May 11, 2023

好的,我周末看下,测试用例看起来有部分失败了,可以先修复下

已修复~

@ShiningRush
Copy link
Owner

@Wenne hi,还麻烦补充下集成测试用例,参考之前的 store 和 keeper 的用例集即可,CI配置可以参考 #24


const LeaderKey = "leader"

// Keeper mongo implement
Copy link
Owner

Choose a reason for hiding this comment

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

typo

Copy link
Author

Choose a reason for hiding this comment

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

已修改

)
}

// todo: just add metrics, register used by existed http server
Copy link
Owner

Choose a reason for hiding this comment

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

这个todo是?

Copy link
Author

Choose a reason for hiding this comment

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

已剔除


type TaskInstanceParams map[string]interface{}

type TaskInstanceDependOn []string
Copy link
Owner

Choose a reason for hiding this comment

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

以上三个结构的定义均是通用的,不用加上TaskInstance的前缀吧

Copy link
Author

Choose a reason for hiding this comment

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

这边之前是为了适配 gorm 序列化必须要 struct 并且实现 json 解析的一些方法才行,但是新办法不需要了,加上 serializer:json 即可。。我这边去掉

Copy link
Author

Choose a reason for hiding this comment

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

已修改

type Election struct {
ID string `gorm:"primaryKey;type:VARCHAR(256);not null"`
WorkerKey string `gorm:"type:VARCHAR(256);not null"`
UpdatedAt time.Time `gorm:"autoUpdateTime;type:timestamp;index;"`
Copy link
Owner

Choose a reason for hiding this comment

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

与 L10 相同

Copy link
Author

Choose a reason for hiding this comment

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

已修改

Save func(data *ShareData) error `json:"-" bson:"-"`

mutex sync.Mutex
mutex sync.Mutex `json:"-" bson:"-"`
Copy link
Owner

Choose a reason for hiding this comment

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

私有化字段不会被序列化,这个tag是无用的

Copy link
Author

Choose a reason for hiding this comment

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

已修改

type ShareData struct {
Dict map[string]string
Save func(data *ShareData) error
Save func(data *ShareData) error `json:"-" bson:"-"`
Copy link
Owner

Choose a reason for hiding this comment

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

由于ShareData实现了 JsonMarshalBsonMarshal 方法,因此不需要tag来控制序列化

Copy link
Author

Choose a reason for hiding this comment

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

已修改


// Render variables
func (vars DagInstanceVars) Render(p map[string]interface{}) (map[string]interface{}, error) {
func (vars *DagInstanceVars) Render(p map[string]interface{}) (map[string]interface{}, error) {
Copy link
Owner

@ShiningRush ShiningRush May 15, 2023

Choose a reason for hiding this comment

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

这里调整成引用类型的目的是什么
DagInstanceVars 是一个 map, map本身即为引用类型,因此定义一个指向引用的指针没有太大价值,反而导致 L276 必须要显式去做寻址后才能进行 for range

Copy link
Author

Choose a reason for hiding this comment

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

已修改

@Wenne
Copy link
Author

Wenne commented May 22, 2023

工作时候事情有点多。。我周末再提交 pr 一个个修复下 comments

@Wenne Wenne closed this May 22, 2023
@Wenne Wenne reopened this May 22, 2023
@ShiningRush
Copy link
Owner

ShiningRush commented May 23, 2023

工作时候事情有点多。。我周末再提交 pr 一个个修复下 comments

不急,慢慢弄,我最近事情比较多,也都是只有周末才能仔细瞅瞅代码 😄

@super-sunshines
Copy link

大佬你们还更新不!

@ShiningRush
Copy link
Owner

我这边可以继续review,主要是owner应该没时间投入了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants