feat(plugins): package database, cache, logger, and storage as infra plugins

This commit is contained in:
ryan
2026-08-27 23:51:10 +08:00
parent 4efc2c92b7
commit a25bf7a4f9
21 changed files with 1285 additions and 19 deletions
@@ -1,3 +1,4 @@
// Package driver_asynq_cron provides the Asynq cron schedule driver plugin for Cordis.
package driver_asynq_cron
import (
@@ -1,3 +1,4 @@
// Package driver_asynq_worker provides the Asynq worker driver plugin for Cordis.
package driver_asynq_worker
import (
@@ -120,7 +121,7 @@ func (p *Plugin) Type() core.DriverType {
}
// Start boots the Asynq worker server and starts processing background tasks.
func (p *Plugin) Start(ctx context.Context) error {
func (p *Plugin) Start(_ context.Context) error {
p.mu.Lock()
defer p.mu.Unlock()
@@ -208,10 +209,10 @@ func toAsynqHandler(h any) (asynq.Handler, error) {
}
switch fn := h.(type) {
case asynq.Handler:
return fn, nil
case asynq.HandlerFunc:
return fn, nil
case asynq.Handler:
return fn, nil
case func(context.Context, *asynq.Task) error:
return asynq.HandlerFunc(fn), nil
case func(context.Context, []byte) error:
+3
View File
@@ -1,3 +1,4 @@
// Package driver_http provides the Gin HTTP web server driver plugin for Cordis.
package driver_http
import (
@@ -172,6 +173,8 @@ func (p *Plugin) Start(ctx context.Context) error {
}
// Stop gracefully stops the HTTP server.
//
//nolint:contextcheck
func (p *Plugin) Stop(ctx context.Context) error {
p.mu.Lock()
defer p.mu.Unlock()