1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-12-11 21:57:08 +02:00

Simplify store interfaces (#3437)

Use `store.Store` interface if possible.
This commit is contained in:
qwerty287
2024-02-25 10:37:10 +01:00
committed by GitHub
parent 9b0c4e4e3c
commit cb3efd2cd9
27 changed files with 69 additions and 420 deletions

View File

@@ -22,11 +22,12 @@ import (
"github.com/rs/zerolog/log"
"go.woodpecker-ci.org/woodpecker/v2/server/model"
"go.woodpecker-ci.org/woodpecker/v2/server/store"
)
// WithTaskStore returns a queue that is backed by the TaskStore. This
// ensures the task Queue can be restored when the system starts.
func WithTaskStore(q Queue, s model.TaskStore) Queue {
func WithTaskStore(q Queue, s store.Store) Queue {
tasks, _ := s.TaskList()
if err := q.PushAtOnce(context.Background(), tasks); err != nil {
log.Error().Err(err).Msg("PushAtOnce failed")
@@ -36,7 +37,7 @@ func WithTaskStore(q Queue, s model.TaskStore) Queue {
type persistentQueue struct {
Queue
store model.TaskStore
store store.Store
}
// Push pushes a task to the tail of this queue.