Documentation ¶
Overview ¶
Package gcslock provides distributed locks to use with Google Cloud Storage. The distributed locking algorithm is based on the algorithm from https://www.joyfulbikeshedding.com/blog/2021-05-19-robust-distributed-locking-algorithm-based-on-google-cloud-storage.html.
It does not implement identities, and `refresh` is not allowed to fail.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Error is the error class for this package. Error errs.Class = "gcslock" )
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { Infof(template string, args ...interface{}) Errorf(template string, args ...interface{}) }
Logger is the most basic set of what's needed for Mutex to log state.
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
Mutex is a distributed lock implemented on top of Google Cloud Storage. NewMutex should always be used to construct a Mutex.
type Options ¶
type Options struct { // JSONKey must be set except when Client is set. JSONKey []byte Name string Bucket string // TTL's default is 5 minutes. TTL time.Duration // RefreshInterval's default is 37 seconds. RefreshInterval time.Duration // If Logger is not set, nothing will be logged. Logger Logger // If Client is not set, a new one will be created. Client *gcsops.Client }
Options define how Mutex should be configured.
Directories ¶
Path | Synopsis |
---|---|
Package gcsops provides an API client implementing a fraction of Cloud Storage's API originally needed by gcslock and packages using it.
|
Package gcsops provides an API client implementing a fraction of Cloud Storage's API originally needed by gcslock and packages using it. |
Click to show internal directories.
Click to hide internal directories.