1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use std::time; use redis; pub type RedlockResult<T> = Result<T, RedlockError>; quick_error!{ #[derive(Debug)] pub enum RedlockError { RedisError(err: redis::RedisError) { from(err: redis::RedisError) -> (err) } TimeError(err: time::SystemTimeError) { from(err: time::SystemTimeError) -> (err) } NoServerError { description("Redlock must be initialized with at least one redis server") } TimeoutError { description("Redlock request timeout") } LockExpired { description("The lock has already expired") } UnableToLock { description("Unable to lock the resource") } UnableToUnlock { description("Unable to unlock the resource") } UnableToExtend { description("Unable to extend the resource") } } }