mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-20 11:21:14 +00:00
Implement all the todos
This commit is contained in:
parent
94cb2a9ef3
commit
a2933dbebc
6 changed files with 25 additions and 12 deletions
|
@ -166,7 +166,7 @@ impl UploadError {
|
|||
Self::InvalidToken => ErrorCode::INVALID_DELETE_TOKEN,
|
||||
Self::UnsupportedProcessExtension => ErrorCode::INVALID_FILE_EXTENSION,
|
||||
Self::DuplicateAlias => ErrorCode::DUPLICATE_ALIAS,
|
||||
Self::PushJob(_) => todo!(),
|
||||
Self::PushJob(_) => ErrorCode::PUSH_JOB,
|
||||
Self::Range => ErrorCode::RANGE_NOT_SATISFIABLE,
|
||||
Self::Limit(_) => ErrorCode::VALIDATE_FILE_SIZE,
|
||||
Self::Timeout(_) => ErrorCode::STREAM_TOO_SLOW,
|
||||
|
|
|
@ -56,12 +56,16 @@ impl ErrorCode {
|
|||
code: "already-claimed",
|
||||
};
|
||||
pub(crate) const SLED_ERROR: ErrorCode = ErrorCode { code: "sled-error" };
|
||||
pub(crate) const POSTGRES_ERROR: ErrorCode = ErrorCode {
|
||||
code: "postgres-error",
|
||||
};
|
||||
pub(crate) const EXTRACT_DETAILS: ErrorCode = ErrorCode {
|
||||
code: "extract-details",
|
||||
};
|
||||
pub(crate) const EXTRACT_UPLOAD_RESULT: ErrorCode = ErrorCode {
|
||||
code: "extract-upload-result",
|
||||
};
|
||||
pub(crate) const PUSH_JOB: ErrorCode = ErrorCode { code: "push-job" };
|
||||
pub(crate) const EXTRACT_JOB: ErrorCode = ErrorCode {
|
||||
code: "extract-job",
|
||||
};
|
||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -2038,16 +2038,14 @@ impl PictRsConfiguration {
|
|||
|
||||
match repo {
|
||||
Repo::Sled(sled_repo) => {
|
||||
launch_file_store(
|
||||
Arc::new(sled_repo.clone()),
|
||||
store,
|
||||
client,
|
||||
config,
|
||||
move |sc| sled_extra_config(sc, sled_repo.clone()),
|
||||
)
|
||||
launch_file_store(arc_repo, store, client, config, move |sc| {
|
||||
sled_extra_config(sc, sled_repo.clone())
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
Repo::Postgres(_) => todo!(),
|
||||
Repo::Postgres(_) => {
|
||||
launch_file_store(arc_repo, store, client, config, |_| {}).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
config::Store::ObjectStorage(config::ObjectStorage {
|
||||
|
@ -2101,7 +2099,9 @@ impl PictRsConfiguration {
|
|||
})
|
||||
.await?;
|
||||
}
|
||||
Repo::Postgres(_) => todo!(),
|
||||
Repo::Postgres(_) => {
|
||||
launch_object_store(arc_repo, store, client, config, |_| {}).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -877,7 +877,7 @@ impl Repo {
|
|||
pub(crate) fn to_arc(&self) -> ArcRepo {
|
||||
match self {
|
||||
Self::Sled(sled_repo) => Arc::new(sled_repo.clone()),
|
||||
Self::Postgres(_) => todo!(),
|
||||
Self::Postgres(postgres_repo) => Arc::new(postgres_repo.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,15 @@ pub(crate) enum PostgresError {
|
|||
|
||||
impl PostgresError {
|
||||
pub(super) const fn error_code(&self) -> ErrorCode {
|
||||
todo!()
|
||||
match self {
|
||||
Self::Pool(_)
|
||||
| Self::Diesel(_)
|
||||
| Self::SerializeDetails(_)
|
||||
| Self::SerializeUploadResult(_)
|
||||
| Self::Hex(_) => ErrorCode::POSTGRES_ERROR,
|
||||
Self::DeserializeDetails(_) => ErrorCode::EXTRACT_DETAILS,
|
||||
Self::DeserializeUploadResult(_) => ErrorCode::EXTRACT_UPLOAD_RESULT,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ diesel::table! {
|
|||
uploads (id) {
|
||||
id -> Uuid,
|
||||
result -> Nullable<Jsonb>,
|
||||
created_at -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue