lock

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: Apache-2.0 Imports: 0 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Properties map[string]string `json:"properties"`
}

Metadata contains a lock store specific set of metadata property.

type Status

type Status int32
const (
	Success            Status = 0
	LockUnexist        Status = 1
	LockBelongToOthers Status = 2
	InternalError      Status = 3
)

lock status.

type Store

type Store interface {
	// Init this component.
	InitLockStore(metadata Metadata) error

	// TryLock tries to acquire a lock.
	TryLock(req *TryLockRequest) (*TryLockResponse, error)

	// Unlock tries to release a lock.
	Unlock(req *UnlockRequest) (*UnlockResponse, error)
}

type TryLockRequest

type TryLockRequest struct {
	ResourceID      string `json:"resourceId"`
	LockOwner       string `json:"lockOwner"`
	ExpiryInSeconds int32  `json:"expiryInSeconds"`
}

TryLockRequest is a lock acquire request.

type TryLockResponse

type TryLockResponse struct {
	Success bool `json:"success"`
}

Lock acquire request was successful or not.

type UnlockRequest

type UnlockRequest struct {
	ResourceID string `json:"resourceId"`
	LockOwner  string `json:"lockOwner"`
}

UnlockRequest is a lock release request.

type UnlockResponse

type UnlockResponse struct {
	Status Status `json:"status"`
}

Status when releasing the lock.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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