fast_cache/storage/embedded_store_sharded/
errors.rs1use super::*;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum LocalStoreInstallError {
6 AlreadyInstalled,
7}
8
9impl fmt::Display for LocalStoreInstallError {
10 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11 match self {
12 Self::AlreadyInstalled => {
13 f.write_str("a worker-local embedded store is already installed on this thread")
14 }
15 }
16 }
17}
18
19impl std::error::Error for LocalStoreInstallError {}
20
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23pub enum LocalStoreAccessError {
24 NotInstalled,
25}
26
27impl fmt::Display for LocalStoreAccessError {
28 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29 match self {
30 Self::NotInstalled => {
31 f.write_str("no worker-local embedded store is installed on this thread")
32 }
33 }
34 }
35}
36
37impl std::error::Error for LocalStoreAccessError {}
38
39#[derive(Debug, Clone, Copy, PartialEq, Eq)]
41pub enum LocalRouteError {
42 KeyNotLocal { shard_id: usize },
43 SessionNotLocal { shard_id: usize },
44}
45
46impl fmt::Display for LocalRouteError {
47 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
48 match self {
49 Self::KeyNotLocal { shard_id } => {
50 write!(
51 f,
52 "key routes to shard {shard_id}, which is not owned by this thread"
53 )
54 }
55 Self::SessionNotLocal { shard_id } => write!(
56 f,
57 "session routes to shard {shard_id}, which is not owned by this thread"
58 ),
59 }
60 }
61}
62
63impl std::error::Error for LocalRouteError {}