dlm

package
v0.0.0-...-d386c04 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(key string) string

Types

type Config

type Config struct {
	Uri        string `json:"uri" yaml:"uri" mapstructure:"uri"`
	TimeToLive uint64 `json:"time_to_live" yaml:"time_to_live" mapstructure:"time_to_live"`
}

func (*Config) Validate

func (conf *Config) Validate() error

type DistributedLockManager

type DistributedLockManager interface {
	Lock(ctx context.Context) error
	Unlock(ctx context.Context) error
}

type Factory

type Factory func(key string, opts ...Option) DistributedLockManager

func New

func New(conf *Config) (Factory, error)

func NewRedlock

func NewRedlock(conf *Config) (Factory, error)

type Option

type Option func(*Config)

func TimeToLive

func TimeToLive(ttl uint64) Option

Jump to

Keyboard shortcuts

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