Documentation
¶
Overview ¶
Package api contains the basic constants, enums and data structures for distrilock API communication.
Index ¶
Constants ¶
View Source
const ( // VersionMajor is the major version of the distrilock protocol VersionMajor = 0 // VersionMinor is the minor version of the distrilock protocol VersionMinor = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LockCommand ¶
type LockCommand uint8
LockCommand is a lock command that the client can request.
const ( // Peek is the command used to verify current status of a named lock. Peek LockCommand // Acquire is the command used to request acquisition of a named lock. Acquire // Release is the command used to request release of a named lock. Release // Verify is the command used to verify that a named lock has been acquired by the caller. Verify )
func (LockCommand) String ¶
func (lc LockCommand) String() string
type LockCommandResult ¶
type LockCommandResult uint8
LockCommandResult is the result of a lock command.
const ( // Failed is returned when the command failed with the specified reason. Failed LockCommandResult // Success is returned when the command succeeded. Success // BadRequest is returned when the specified parameters are invalid. BadRequest // InternalError is returned when an unexpected internal error happened while serving the command. InternalError )
func (LockCommandResult) String ¶
func (lcr LockCommandResult) String() string
String returns the human-readable description of the lock command result.
type LockRequest ¶
type LockRequest struct {
VersionMajor uint8
VersionMinor uint8
Command LockCommand
LockName string
}
LockRequest is a lock command request descriptor.
type LockResponse ¶
type LockResponse struct {
LockRequest
Result LockCommandResult
// Reason is the extra human-readable text provided in case of failure, errors, success.
Reason string
// IsLocked is specified when peeking lock status.
IsLocked bool
}
LockResponse is a response to a LockRequest; it always embeds the request's command and lock name.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client defines the distrilock client interface and associated types.
|
Package client defines the distrilock client interface and associated types. |
|
internal/base
Package bclient is an internal package for the common API client functionality.
|
Package bclient is an internal package for the common API client functionality. |
|
tcp
Package tcp provides a distrilock client over TCP.
|
Package tcp provides a distrilock client over TCP. |
|
ws
Package ws provides a distrilock client over Websockets; both binary (GOP) and text (JSON) messages are supported.
|
Package ws provides a distrilock client over Websockets; both binary (GOP) and text (JSON) messages are supported. |
|
Package core defines the POSIX-specific primitives to acquire, peek and release locks using fcntl and basic file opening OS capabilities.
|
Package core defines the POSIX-specific primitives to acquire, peek and release locks using fcntl and basic file opening OS capabilities. |
Click to show internal directories.
Click to hide internal directories.