agola/internal/sqlg/lock/lock.go

20 lines
282 B
Go

package lock
import (
"context"
"github.com/sorintlab/errors"
)
var ErrLocked = errors.New("already locked")
type LockFactory interface {
NewLock(key string) Lock
}
type Lock interface {
Lock(ctx context.Context) error
TryLock(ctx context.Context) error
Unlock() error
}