-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
43 lines (30 loc) · 1.53 KB
/
errors.go
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
39
40
41
42
43
package storage_lock
import "errors"
// ErrLockIdEmpty 参数相关的参数检查
var (
ErrLockIdEmpty = errors.New("lock id can not empty")
ErrLeaseExpireAfter = errors.New("LeaseExpireAfter must > time.Second * 3 ")
ErrLeaseRefreshInterval = errors.New("LeaseRefreshInterval must < ErrLeaseExpireAfter ")
)
var (
// ErrLockFailed 尝试加锁失败
ErrLockFailed = errors.New("lock failed")
// ErrLockBusy 锁在被其它人持有着
ErrLockBusy = errors.New("lock busy")
// ErrLockAlreadyExists 锁已经存在,无法继续进行给定操作
ErrLockAlreadyExists = errors.New("lock already exists")
// ErrUnlockFailed 锁释放失败,锁是自己的,但由于种种原因释放失败了
ErrUnlockFailed = errors.New("unlock failed")
// ErrLockNotFound 要操作的锁不存在,本来无一物,何处染尘埃,无法在不存在的锁上施加操作
ErrLockNotFound = errors.New("lock not found")
// ErrLockNotBelongYou 尝试释放不属于自己的锁,一般情况下不应该有这个错误,除非发生了越权操作
ErrLockNotBelongYou = errors.New("v not belong you")
// ErrLockRefreshFailed 刷新锁的过期时间时出错
ErrLockRefreshFailed = errors.New("lock refresh failed")
)
var (
// ErrVersionMiss 版本未命中,基于版本操作时比较常见的问题
ErrVersionMiss = errors.New("compare and set miss")
// ErrOwnerCanOnlyOne 锁的有拥有者只能有一个,这是尝试给锁指定了多个owner时会返回的错误
ErrOwnerCanOnlyOne = errors.New("lock owner only one")
)