Documentation
¶
Index ¶
- Constants
- func GetEtcdClient(host string, timeout time.Duration, user string, pass string) (*clientv3.Client, error)
- func GetEtcdTLSClient(host string, tls *tls.Config, timeout time.Duration) (*clientv3.Client, error)
- func GetMutex(session *concurrency.Session, prefix string) *concurrency.Mutex
- func GetSession(client *clientv3.Client) (*concurrency.Session, error)
- type Lock
Constants ¶
View Source
const ProdMutexPrefix = "/gromit/prod/"
ProdMutexPrefix is the prefix for all the created mutex objects.
View Source
const TestMutexPrefix = "/gromit/test/"
TestMutexPrefix should only be used from within unit and integration tests.
Variables ¶
This section is empty.
Functions ¶
func GetEtcdClient ¶
func GetEtcdClient(host string, timeout time.Duration, user string, pass string) (*clientv3.Client, error)
GetEtcdClient creates an etcd client.
func GetEtcdTLSClient ¶
func GetMutex ¶
func GetMutex(session *concurrency.Session, prefix string) *concurrency.Mutex
func GetSession ¶
func GetSession(client *clientv3.Client) (*concurrency.Session, error)
Types ¶
type Lock ¶
type Lock struct { Client *clientv3.Client Session *concurrency.Session Mutex *concurrency.Mutex }
func (*Lock) TryAcquire ¶
Try to adquire a lock (non-blocking), if process is locked will log error and exit without locking
Click to show internal directories.
Click to hide internal directories.