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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
extern crate ql2;
extern crate protobuf;
extern crate serde_json;
#[macro_use]
extern crate derive_error;
#[cfg(feature = "with_io")]
extern crate reql_io;
#[macro_use]
extern crate slog;
#[macro_use]
mod macros;
mod types;
mod commands;
pub mod errors;
#[doc(hidden)]
pub use ql2::proto::Term;
#[cfg(feature = "with_io")]
use std::net::SocketAddr;
#[cfg(feature = "with_io")]
use std::sync::Arc;
use errors::Error;
#[cfg(feature = "with_io")]
use reql_io::r2d2;
#[cfg(feature = "with_io")]
use reql_io::tokio_core::reactor::Remote;
#[cfg(feature = "with_io")]
use reql_io::tokio_core::net::TcpStream;
use slog::Logger;
pub type Result<T> = ::std::result::Result<T, Error>;
#[derive(Debug, Clone)]
pub struct Arg {
string: String,
term: Term,
pool: Option<Pool>,
}
#[cfg(feature = "with_io")]
#[derive(Debug, Clone)]
pub struct Response;
#[cfg(feature = "with_io")]
#[derive(Debug, Clone)]
pub struct Pool(Vec<DataCentre>);
#[cfg(feature = "with_io")]
#[doc(hidden)]
pub struct Connection {
id: u64,
broken: bool,
server: Server,
stream: TcpStream,
logger: Logger,
}
#[cfg(feature = "with_io")]
#[derive(Clone)]
struct ConnectionManager {
server: Server,
remote: Remote,
logger: Logger,
}
#[cfg(feature = "with_io")]
#[derive(Debug)]
struct ClusterConfig(Vec<Cluster>);
#[cfg(feature = "with_io")]
#[derive(Debug, Clone)]
struct DataCentre();
#[cfg(feature = "with_io")]
#[derive(Debug, Clone)]
struct Server(Vec<SocketAddr>);
#[cfg(feature = "with_io")]
#[derive(Debug)]
struct Cluster(Vec<Server>);
#[cfg(feature = "with_io")]
#[derive(Debug, Clone)]
struct TlsCfg {
ca_certs: String,
}
#[cfg(feature = "with_io")]
#[derive(Debug)]
struct Opts {
db: String,
user: String,
password: String,
retries: u8,
tls: Option<TlsCfg>,
}
#[cfg(feature = "with_io")]
#[derive(Debug, Clone)]
struct Config {
pool: Arc<r2d2::Config<Connection, Error>>,
servers: Vec<Server>,
}
#[must_use]
#[derive(Debug, Clone)]
pub struct Client {
term: Term,
query: String,
logger: Logger,
}
#[derive(Debug, Clone)]
#[doc(hidden)]
pub struct Args {
term: Term,
string: String,
pool: Option<Pool>,
}
pub trait ToArg {
fn to_arg(&self) -> Arg;
}