dlock

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dlock provide distributed lock function

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKindIsEmpty   = errors.New("dlock's kind is empty")
	ErrIsInitialized = errors.New("instance has been initialized")
)
View Source
var ErrDLockNotExists = errors.New("DLock do not exist")

Functions

func Init

func Init(opts Options) (err error)

func Install

func Install(pluginImplName string, f initFunc)

func IsHoldLock

func IsHoldLock(key string) bool

func Lock

func Lock(key string, ttl int64) error

func Renew

func Renew(key string) error

func TryLock

func TryLock(key string, ttl int64) error

func Unlock

func Unlock(key string) error

Types

type DLock

type DLock interface {
	Lock(key string, ttl int64) error
	TryLock(key string, ttl int64) error
	Renew(key string) error
	IsHoldLock(key string) bool
	Unlock(key string) error
}

func Instance

func Instance() DLock

type Options

type Options struct {
	Kind string
}

Options contains configuration for plugins

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL