forked from
microcosm.blue/microcosm-rs
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1use crate::db_types::EncodingError;
2use crate::UFOsCommit;
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum FirehoseEventError {
7 #[error("Create/Update commit operation missing record data")]
8 CruMissingRecord,
9 #[error("Account event missing account info")]
10 AccountEventMissingAccount,
11 #[error("Commit event missing commit info")]
12 CommitEventMissingCommit,
13}
14
15#[derive(Debug, Error)]
16pub enum BatchInsertError {
17 #[error("Batch is full and no creates are left to be truncated")]
18 BatchFull(UFOsCommit),
19 #[error("Bug: tried to index beyond batch limit: {0}")]
20 BatchOverflow(usize),
21 #[error("Bug: non-terminating head advancement??")]
22 BatchForever,
23}
24
25#[derive(Debug, Error)]
26pub enum StorageError {
27 #[error("Failed to initialize: {0}")]
28 InitError(String),
29 #[error("DB seems to be in a bad state: {0}")]
30 BadStateError(String),
31 #[error("Fjall error")]
32 FjallError(#[from] fjall::Error),
33 #[error("LSM-tree error (from fjall)")]
34 FjallLsmError(#[from] fjall::LsmError),
35 #[error("Bytes encoding error")]
36 EncodingError(#[from] EncodingError),
37 #[error("If you ever see this, there's a bug in the code. The error was stolen")]
38 Stolen,
39 #[error("Failed to join tokio task: {0}")]
40 JoinError(#[from] tokio::task::JoinError),
41 #[error("Background task already started")]
42 BackgroundAlreadyStarted,
43 #[error("Batch sender exited")]
44 BatchSenderExited,
45}