distrlock

package
v0.19.9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

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