initial commit
This commit is contained in:
12
pkg/locker/interface.go
Normal file
12
pkg/locker/interface.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package locker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Locker interface {
|
||||
Lock(ctx context.Context, id string, ttl time.Duration) (bool, error)
|
||||
Unlock(ctx context.Context, id string) error
|
||||
WithLock(ctx context.Context, lockKey string, lockTime time.Duration, fn func(context.Context) error) error
|
||||
}
|
||||
Reference in New Issue
Block a user