1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use crate::commands;
use crate::error::RedisError;
use crate::interfaces::{async_spawn, AsyncResult, ClientLike};
use crate::types::{FromRedis, RedisValue};
use crate::utils;
use bytes_utils::Str;
use std::convert::TryInto;
pub trait ConfigInterface: ClientLike + Sized {
fn config_resetstat(&self) -> AsyncResult<()> {
async_spawn(self, |inner| async move {
utils::disallow_during_transaction(&inner)?;
commands::config::config_resetstat(&inner).await
})
}
fn config_rewrite(&self) -> AsyncResult<()> {
async_spawn(self, |inner| async move {
utils::disallow_during_transaction(&inner)?;
commands::config::config_rewrite(&inner).await
})
}
fn config_get<R, S>(&self, parameter: S) -> AsyncResult<R>
where
R: FromRedis + Unpin + Send,
S: Into<Str>,
{
into!(parameter);
async_spawn(self, |inner| async move {
utils::disallow_during_transaction(&inner)?;
commands::config::config_get(&inner, parameter).await?.convert()
})
}
fn config_set<P, V>(&self, parameter: P, value: V) -> AsyncResult<()>
where
P: Into<Str>,
V: TryInto<RedisValue>,
V::Error: Into<RedisError>,
{
into!(parameter);
try_into!(value);
async_spawn(self, |inner| async move {
utils::disallow_during_transaction(&inner)?;
commands::config::config_set(&inner, parameter, value).await
})
}
}