File size: 746 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
package compatmanager
import (
"context"
"database/sql"
"github.com/target/goalert/engine/processinglock"
"github.com/target/goalert/notification/slack"
)
// DB handles keeping compatibility-related data in sync.
type DB struct {
db *sql.DB
lock *processinglock.Lock
cs *slack.ChannelSender
}
// Name returns the name of the module.
func (db *DB) Name() string { return "Engine.CompatManager" }
// NewDB creates a new DB.
func NewDB(ctx context.Context, db *sql.DB, cs *slack.ChannelSender) (*DB, error) {
lock, err := processinglock.NewLock(ctx, db, processinglock.Config{
Version: 1,
Type: processinglock.TypeCompat,
})
if err != nil {
return nil, err
}
return &DB{
db: db,
lock: lock,
cs: cs,
}, nil
}
|