Documentation ¶
Overview ¶
looper package provides utilities for looper job management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributedLock ¶
type DistributedLock interface { // Lock the key Lock(ctx context.Context, key string, expiration time.Duration) (ok bool, err error) // Unlock the key Unlock(ctx context.Context, key string) (err error) // Renew the key expiration time Renew(ctx context.Context, key string, expiration time.Duration) (err error) }
分布式锁
type RedisLock ¶
type RedisLock struct {
// contains filtered or unexported fields
}
RedisLock implemented the DistributedLock interface
func NewRedisLock ¶
func NewRedisLock(client *redis.Client) *RedisLock
func (*RedisLock) Lock ¶
func (l *RedisLock) Lock(ctx context.Context, key string, expiration time.Duration) (ok bool, err error)
Lock the key
type SinglePod ¶
type SinglePod struct { ErrCh chan error // 错误通道 // contains filtered or unexported fields }
SinglePod 单Pod执行的任务
func NewSinglePod ¶
func NewSinglePod(id string, lock DistributedLock, run func(ctx context.Context) error, cleanup func(), conf SinglePodConfig) (*SinglePod, func(), error)
NewSinglePod 创建单Pod执行的任务
Click to show internal directories.
Click to hide internal directories.