try_lock

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

try_lock

import "github.com/ccheers/xpkg/sync/try_lock"

Index

func SimpleDistributedTryLock

func SimpleDistributedTryLock(command CASCommand, key string, duration time.Duration, opts ...Option) (func(), error)

type CASCommand

type CASCommand interface {
    CAS(key, src, dst string) bool
}

type Option

type Option func(*options)
func WithScheduleFunc
func WithScheduleFunc(f func()) Option

type Schedule

type Schedule func()

type TryMutexLocker

type TryMutexLocker interface {
    Unlock()
    TryLock(duration time.Duration) error
}
func NewChMutex
func NewChMutex() TryMutexLocker
func NewDistributedTryLocker
func NewDistributedTryLocker(cmd CASCommand, key, value string, opts ...Option) TryMutexLocker

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SimpleDistributedTryLock added in v1.0.3

func SimpleDistributedTryLock(command CASCommand, key string, duration time.Duration, opts ...Option) (func(), error)

Types

type CASCommand

type CASCommand interface {
	CAS(key, src, dst string) bool
}

type Option

type Option func(*options)

func WithScheduleFunc

func WithScheduleFunc(f func()) Option

type Schedule

type Schedule func()

type TryMutexLocker

type TryMutexLocker interface {
	Unlock()
	TryLock(duration time.Duration) error
}

func NewChMutex

func NewChMutex() TryMutexLocker

func NewDistributedTryLocker

func NewDistributedTryLocker(cmd CASCommand, key, value string, opts ...Option) TryMutexLocker

Jump to

Keyboard shortcuts

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