All Projects → go-locks → distlock

go-locks / distlock

Licence: Apache-2.0 license
The universal component of distributed locks in golang , support redis and postgresql

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to distlock

slow-down
A centralized Redis-based lock to help you wait on throttled resources
Stars: ✭ 21 (-65%)
Mutual labels:  lock, locks, distributed
mutex
Mutex lock implementation
Stars: ✭ 28 (-53.33%)
Mutual labels:  lock, mutex
AtomicKit
Concurrency made simple in Swift.
Stars: ✭ 88 (+46.67%)
Mutual labels:  lock, mutex
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (+496.67%)
Mutual labels:  lock, distributed
concurrency-kit
🚄 Concurrency abstractions framework for Apple Platforms [Task, Atomic, Lock, Operation, etc.].
Stars: ✭ 17 (-71.67%)
Mutual labels:  locks, mutex
Pottery
Redis for humans. 🌎🌍🌏
Stars: ✭ 204 (+240%)
Mutual labels:  lock, distributed
Redisson
Redisson - Redis Java client with features of In-Memory Data Grid. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Publish / Subscribe, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, MyBatis, RPC, local cache ...
Stars: ✭ 17,972 (+29853.33%)
Mutual labels:  lock, distributed
futex
File-based Ruby Mutex
Stars: ✭ 14 (-76.67%)
Mutual labels:  lock, mutex
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+2175%)
Mutual labels:  lock, distributed
Redlock Php
Redis distributed locks in PHP
Stars: ✭ 651 (+985%)
Mutual labels:  lock, distributed
run exclusive
⚡🔒 Wait queue for function execution 🔒 ⚡
Stars: ✭ 22 (-63.33%)
Mutual labels:  lock, mutex
mutexsafe
MutexSafe will help you use mutex more effectively. Different mutex for different components are presented. In addition, you can add your own lockers and use within the library.
Stars: ✭ 15 (-75%)
Mutual labels:  lock, mutex
Redislock
Simplified distributed locking implementation using Redis
Stars: ✭ 370 (+516.67%)
Mutual labels:  lock, distributed
async
Synchronization and asynchronous computation package for Go
Stars: ✭ 104 (+73.33%)
Mutual labels:  lock, mutex
go-lock
go-lock is a lock library implementing read-write mutex and read-write trylock without starvation
Stars: ✭ 78 (+30%)
Mutual labels:  lock, mutex
optuna-examples
Examples for https://github.com/optuna/optuna
Stars: ✭ 238 (+296.67%)
Mutual labels:  distributed
dlock
Interval Lock
Stars: ✭ 19 (-68.33%)
Mutual labels:  lock
oceanbase
OceanBase is an enterprise distributed relational database with high availability, high performance, horizontal scalability, and compatibility with SQL standards.
Stars: ✭ 4,466 (+7343.33%)
Mutual labels:  distributed
rearq
A distributed task queue built with asyncio and redis, with built-in web interface
Stars: ✭ 81 (+35%)
Mutual labels:  distributed
money
Dapper Style Distributed Tracing Instrumentation Libraries
Stars: ✭ 65 (+8.33%)
Mutual labels:  distributed

Go-Locks License

通用的Golang分布式锁组件,更多使用案例详见 examples

Driver列表

若有意向贡献未完成的驱动代码,请通过 ISSUES 或 邮箱 [email protected] 联系我

Driver 代码完成度 测试完成度 依赖包 使用说明
redis 100% 100% letsfire/redigo 详见 README.md
pgsql 100% 100% lib/pq 详见 README.md
etcd 未完成 未测试 etcd/client 详见 README.md
etcdv3 未完成 未测试 etcd/clientv3 详见 README.md

方法说明

配置项 mutex.OptFunc 以及返回值锁的使用详见 mutex/README.md

  • NewMutex(name string, optFuncs ...mutex.OptFunc) (*mutex.Mutex, error)
    创建互斥锁,若 name 已用于创建读写锁则返回 error,本方法单例模式
  • NewRWMutex(name string, optFuncs ...mutex.OptFunc) (*mutex.RWMutex, error)
    创建读写锁,若 name 已用于创建互斥锁则返回 error,本方法单例模式

注意事项

  • 不可重入(如果您有强烈的需求场景,请通过 ISSUES 提供反馈)
  • 非公平锁(Golang的本地锁 sync.Locker 视乎也不是公平锁,若您有需求或建议,请通过 ISSUES 提供反馈)
  • 有互斥锁 mutex 和 读写锁 rwmutex 两种类型,具体支持程度详见各个 Driver 对应的 README.md
  • 虽有完整的单元测试,但暂未经过实际项目考验,故慎用于生产环境,如有问题请通过 ISSUES 来共同完善

项目结构

  • 主线调用层级为 distlock.go -> mutex.go -> driver.go
  • distlock.go 提供了创建锁的工厂类,单例模式(相同名称的锁有且仅有一个,有且仅为一种)
  • mutex.go提供了各类锁的实现,欢迎各位同学贡献其他类型锁,详见 mutex/README.md
  • driver.go提供驱动接口的定义,欢迎各位同学贡献其他驱动,详见 driver/README.md
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].