distrlock

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalStateService

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

LocalStateService is designed to save stream state info into a local file. It's not supported to satisfy HA requirement. It mainly works when paired with LocalWebSocketEngine.

func NewLocalStateService

func NewLocalStateService(logger log.Logger, lockerID string, lockFileDir string) (s *LocalStateService, err error)

func (*LocalStateService) FetchDistLock

func (s *LocalStateService) FetchDistLock(lockKey string, locker string, expiredInMS int) (bool, error)

DiskLock is not supported in LocalStateService, in the other word, FetchDistLock and ReleaseDistLock will always be success.

func (*LocalStateService) GetDistState

func (s *LocalStateService) GetDistState(stateKey string) (state string, err error)

func (*LocalStateService) GetLockerID

func (s *LocalStateService) GetLockerID() string

func (*LocalStateService) ReleaseDistLock

func (s *LocalStateService) ReleaseDistLock(lockKey string, locker string) (bool, error)

func (*LocalStateService) RemoveStateFile

func (s *LocalStateService) RemoveStateFile(stateKey string) error

func (*LocalStateService) SetDistState

func (s *LocalStateService) SetDistState(stateKey string, stateValue string) error

func (*LocalStateService) UnlockDistLockWithState

func (s *LocalStateService) UnlockDistLockWithState(
	lockKey string, locker string, stateKey string, stateValue string) (bool, error)

type RedisDistributeStateService

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

func NewRedisDistributeStateService

func NewRedisDistributeStateService(redisURL string, redisPass string, logger log.Logger, lockerID string) (*RedisDistributeStateService, error)

func (*RedisDistributeStateService) FetchDistLock

func (s *RedisDistributeStateService) FetchDistLock(lockKey string, locker string, expiredInMS int) (bool, error)

func (*RedisDistributeStateService) GetDistState

func (s *RedisDistributeStateService) GetDistState(stateKey string) (string, error)

func (*RedisDistributeStateService) GetLockerID

func (s *RedisDistributeStateService) GetLockerID() string

func (*RedisDistributeStateService) ReleaseDistLock

func (s *RedisDistributeStateService) ReleaseDistLock(lockKey string, locker string) (bool, error)

func (*RedisDistributeStateService) SetDistState

func (s *RedisDistributeStateService) SetDistState(stateKey string, stateValue string) error

func (*RedisDistributeStateService) UnlockDistLockWithState

func (s *RedisDistributeStateService) UnlockDistLockWithState(lockKey string, locker string, stateKey string, stateValue string) (bool, error)

Jump to

Keyboard shortcuts

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