mutex

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 8 Imported by: 3

README

mutex

chefgo mutex module.

Documentation

Index

Constants

View Source
const (
	NAME    = "MUTEX"
	DEFAULT = "default"
)

Variables

This section is empty.

Functions

func Configure

func Configure(cfg Map)

Configure 更新配置

func Go

func Go()

Go 直接开跑 此方法只单独使用模块时用

func Lock

func Lock(args ...Any) error

func LockTo

func LockTo(conn string, args ...Any) error

func Locked

func Locked(args ...Any) bool

func Ready

func Ready()

Ready 准备运行 此方法只单独使用模块时用

func Register

func Register(name string, value Any, overrides ...bool)

Register 开放给外

func Unlock

func Unlock(args ...Any) error

func UnlockFrom

func UnlockFrom(conn string, args ...Any) error

Types

type Config

type Config struct {
	Driver  string
	Weight  int
	Prefix  string
	Expiry  time.Duration
	Setting Map
}

type Configs

type Configs map[string]Config

type Connect

type Connect interface {
	//打开、关闭
	Open() error
	Close() error

	Lock(key string, expiry time.Duration) error
	Unlock(key string) error
}

Connect 会话连接

type Driver

type Driver interface {
	Connect(name string, config Config) (Connect, error)
}

Driver 数据驱动

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

type Module

type Module struct {
	// contains filtered or unexported fields
}

func (*Module) Config

func (this *Module) Config(name string, config Config, override bool)

func (*Module) Configs

func (this *Module) Configs(config Configs, override bool)

func (*Module) Configure

func (this *Module) Configure(global Map)

func (*Module) Connect

func (this *Module) Connect()

func (*Module) Driver

func (module *Module) Driver(name string, driver Driver, override bool)

Driver 注册驱动

func (*Module) Initialize

func (this *Module) Initialize()

func (*Module) Launch

func (this *Module) Launch()

func (*Module) Lock

func (this *Module) Lock(key string, expiries ...time.Duration) error

Lock 加锁

func (*Module) LockTo

func (this *Module) LockTo(conn string, key string, expiries ...time.Duration) error

LockTo 加锁到指定的连接

func (*Module) Register

func (this *Module) Register(name string, value Any, override bool)

func (*Module) Terminate

func (this *Module) Terminate()

func (*Module) Unlock

func (this *Module) Unlock(key string) error

Unlock 解锁

func (*Module) UnlockFrom

func (this *Module) UnlockFrom(locate string, key string) error

UnlockFrom 从指定的连接解锁

Jump to

Keyboard shortcuts

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