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
use std::io;
/// Details of [`Error::IncompleteBucketMap`].
#[derive(Debug)]
#[non_exhaustive]
pub struct IncompleteBucketMap {
/// Tier whose bucket map is incomplete.
pub tier: String,
/// Number of buckets actually covered by the map.
pub covered: u64,
/// Number of buckets the tier is configured with.
pub expected: u64,
}
/// Picodata error.
#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum Error {
/// Manager has been closed, no further operations allowed.
#[error("manager has been closed")]
Closed,
/// No online instances available to handle the request.
#[error("no online instances available")]
Unreachable,
/// The instance a query was pinned to is unknown or offline.
#[error("instance {0} is not available")]
InstanceUnavailable(String),
/// A tier's buckets are not fully covered by the topology.
#[error(
"bucket map for tier {} covers {} of {} buckets",
.0.tier, .0.covered, .0.expected
)]
IncompleteBucketMap(Box<IncompleteBucketMap>),
/// Address could not be parsed from returned row.
#[error("instance address is invalid: {0}")]
InvalidAddress(String),
/// Port could not be parsed from returned row.
#[error("instance port is invalid")]
InvalidPort,
/// A UUID could not be parsed from returned row.
#[error("uuid is invalid: {0}")]
InvalidUuid(#[from] uuid::Error),
/// Any error happened within tokio postgres.
#[error("postgres protocol error: {0}")]
Postgres(#[from] pg::Error),
/// Any error happended within deadpool.
#[error("postgres pool error: {0}")]
PostgresPool(#[from] pgpool::PoolError),
/// Any error happened on I/O.
#[error("io error: {0}")]
IO(#[from] io::Error),
}