-
Notifications
You must be signed in to change notification settings - Fork 30
refactor(database): move worker logic into separate package #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…to refactor/database/repo
…to refactor/database/worker
…into refactor/database/worker
…into refactor/database/worker
…into refactor/database/worker
cognifloyd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this moves from GetWorker to GetWorkerByHostname which is much better.
It also drops GetWorkerByAddress - should we re-add that?
|
@cognifloyd When I discovered this during the refactor, I elected to not include it. However, if we feel there is a good reason to keep it, I could certainly do so. |
Based off of #574, #663 and #687
This change continues the refactor efforts initially introduced in the above PRs.
This adds a new
workerpackage to thegithub.amrom.workers.dev/go-vela/server/databasepackage.This contains a
WorkerServiceinterface declaring all functions necessary for worker based interactions with the database:server/database/worker/service.go
Lines 11 to 43 in 7991f03
This package also contains the
enginewhich implements the above service interface:server/database/worker/worker.go
Lines 23 to 37 in 7991f03
This
enginecontains no raw SQL queries for integrating with theworkerstable.Instead, we leverage our DB library's (https://gorm.io/) agnostic abstraction for integrating with that table.