stcql

package module
v0.0.0-...-72e1254 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

stcql

SmartThings Cassandra Go Library

Documentation

Index

Constants

View Source
const CQLRetries = 5
View Source
const CQLTimeFmt = "2006-01-02 15:04:05-0700"

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

type Mutex struct {
	Session    *gocql.Session
	Keyspace   string
	Table      string
	LockName   string
	LockHolder string
	// Lifetime is the duration that the mutex is valid after it's acquired.
	// It is considered stale after the duration has passed.
	Lifetime time.Duration
	// RetryTime is the duration between attempts to acquire the mutex
	RetryTime time.Duration
	// Timeout is the duration after which to give up acquiring the mutex
	Timeout time.Duration
}

Mutex represents a mutex that is acquired by inserting a row into a Cassandra table using a lightweight transaction.

func (*Mutex) Lock

func (m *Mutex) Lock() error

Lock attempts to acquire mutex m. If the lock is already in use, the calling goroutine blocks until the mutex is available

func (*Mutex) Locker

func (m *Mutex) Locker() sync.Locker

Locker returns a sync.Locker interface for Mutex

func (*Mutex) Unlock

func (m *Mutex) Unlock() error

Unlock unlocks m. Unlock returns an error if m is not locked on entry.

Jump to

Keyboard shortcuts

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