client

package
v0.0.0-...-3a72dd1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2017 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package client defines the distrilock client interface and associated types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Acquire will acquire a named lock through the distrilock daemon.
	Acquire(lockName string) (*Lock, error)
	// Release will release a locked name previously acquired in this session.
	Release(l *Lock) error
	// IsLocked returns true when distrilock deamon estabilished that lock is currently acquired.
	IsLocked(lockName string) (bool, error)
	// Verify will verify that the lock is currently held by the client and healthy.
	Verify(l *Lock) error
	// Close releases all session-specific resources of this client.
	Close() error
}

Client is a generic distrilock client interface.

type Error

type Error struct {
	Result api.LockCommandResult
	Reason string
}

Error is the composite error return by all client method calls.

func (*Error) Error

func (e *Error) Error() string

Error returns the associated summary of the ClientError e.

type Lock

type Lock struct {
	Client
	Name string
}

Lock is a client-specific acquired lock object.

func (*Lock) Release

func (l *Lock) Release() error

Release is a short-hand to call Client.Release for Lock l.

func (*Lock) String

func (l *Lock) String() string

String returns the lock name and the associated client.

func (*Lock) Verify

func (l *Lock) Verify() error

Verify is a short-hand to call Client.Verify for Lock l.

Directories

Path Synopsis
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.
Package tcp provides a distrilock client over TCP.
Package tcp provides a distrilock client over TCP.
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.

Jump to

Keyboard shortcuts

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