mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-20 11:21:14 +00:00
ffmpeg features, sled 034
This commit is contained in:
parent
a069122d80
commit
4a3bd42c14
4 changed files with 404 additions and 353 deletions
700
Cargo.lock
generated
700
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,11 @@ edition = "2018"
|
|||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
ffmpeg43 = ["ffmpeg", "ffmpeg-next/ffmpeg43"]
|
||||
ffmpeg42 = ["ffmpeg", "ffmpeg-next/ffmpeg42"]
|
||||
ffmpeg = ["ffmpeg-next/codec", "ffmpeg-next/filter", "ffmpeg-next/device", "ffmpeg-next/format", "ffmpeg-next/resampling", "ffmpeg-next/postprocessing", "ffmpeg-next/software-resampling", "ffmpeg-next/software-scaling"]
|
||||
|
||||
[dependencies]
|
||||
actix-form-data = { git = "https://git.asonix.dog/Aardwolf/actix-form-data" }
|
||||
actix-fs = { git = "https://git.asonix.dog/asonix/actix-fs", branch = "main" }
|
||||
|
@ -27,7 +32,8 @@ rexiv2 = { version = "0.9.0", git = "https://git.asonix.dog/asonix/rexiv2" }
|
|||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
sha2 = "0.9.0"
|
||||
sled = "0.32.0"
|
||||
sled032 = { version = "0.32.0", package = "sled" }
|
||||
sled = { version = "0.34.4" }
|
||||
structopt = "0.3.14"
|
||||
thiserror = "1.0"
|
||||
tracing = "0.1.15"
|
||||
|
|
|
@ -9,6 +9,9 @@ pub(crate) enum UploadError {
|
|||
#[error("Couldn't save file, {0}")]
|
||||
Save(#[from] actix_fs::Error),
|
||||
|
||||
#[error("Error in DB migration, {0}")]
|
||||
Migrate(#[from] sled032::Error),
|
||||
|
||||
#[error("Error in DB, {0}")]
|
||||
Db(#[from] sled::Error),
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use crate::UploadError;
|
||||
use sled as sled032;
|
||||
use sled as sled034;
|
||||
use sled032;
|
||||
use std::path::PathBuf;
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
const SLED_034: &str = "db-0.34";
|
||||
const SLED_032: &str = "db-0.32";
|
||||
const SLED_0320_RC1: &str = "db";
|
||||
|
||||
|
@ -18,7 +20,7 @@ impl LatestDb {
|
|||
LatestDb { root_dir, version }
|
||||
}
|
||||
|
||||
pub(crate) fn migrate(self) -> Result<sled032::Db, UploadError> {
|
||||
pub(crate) fn migrate(self) -> Result<sled034::Db, UploadError> {
|
||||
let LatestDb { root_dir, version } = self;
|
||||
|
||||
version.migrate(root_dir)
|
||||
|
@ -28,11 +30,19 @@ impl LatestDb {
|
|||
enum DbVersion {
|
||||
Sled0320Rc1,
|
||||
Sled032,
|
||||
Sled034,
|
||||
Fresh,
|
||||
}
|
||||
|
||||
impl DbVersion {
|
||||
fn exists(root: PathBuf) -> Self {
|
||||
let mut sled_dir = root.clone();
|
||||
sled_dir.push("sled");
|
||||
sled_dir.push(SLED_034);
|
||||
if std::fs::metadata(sled_dir).is_ok() {
|
||||
return DbVersion::Sled034;
|
||||
}
|
||||
|
||||
let mut sled_dir = root.clone();
|
||||
sled_dir.push("sled");
|
||||
sled_dir.push(SLED_032);
|
||||
|
@ -49,19 +59,41 @@ impl DbVersion {
|
|||
DbVersion::Fresh
|
||||
}
|
||||
|
||||
fn migrate(self, root: PathBuf) -> Result<sled032::Db, UploadError> {
|
||||
fn migrate(self, root: PathBuf) -> Result<sled034::Db, UploadError> {
|
||||
match self {
|
||||
DbVersion::Sled0320Rc1 => migrate_0_32_0_rc1(root),
|
||||
DbVersion::Sled032 | DbVersion::Fresh => {
|
||||
DbVersion::Sled0320Rc1 => {
|
||||
migrate_0_32_0_rc1(root.clone())?;
|
||||
migrate_0_32(root)
|
||||
}
|
||||
DbVersion::Sled032 => migrate_0_32(root),
|
||||
DbVersion::Sled034 | DbVersion::Fresh => {
|
||||
let mut sled_dir = root;
|
||||
sled_dir.push("sled");
|
||||
sled_dir.push(SLED_032);
|
||||
Ok(sled032::open(sled_dir)?)
|
||||
sled_dir.push(SLED_034);
|
||||
Ok(sled034::open(sled_dir)?)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn migrate_0_32(mut root: PathBuf) -> Result<sled034::Db, UploadError> {
|
||||
info!("Migrating database from 0.32 to 0.34");
|
||||
root.push("sled");
|
||||
|
||||
let mut sled_dir = root.clone();
|
||||
sled_dir.push(SLED_032);
|
||||
|
||||
let mut new_sled_dir = root.clone();
|
||||
new_sled_dir.push(SLED_034);
|
||||
|
||||
let old_db = sled032::open(sled_dir)?;
|
||||
let new_db = sled034::open(new_sled_dir)?;
|
||||
|
||||
new_db.import(old_db.export());
|
||||
|
||||
Ok(new_db)
|
||||
}
|
||||
|
||||
fn migrate_0_32_0_rc1(root: PathBuf) -> Result<sled032::Db, UploadError> {
|
||||
info!("Migrating database from 0.32.0-rc1 to 0.32.0");
|
||||
let mut sled_dir = root.clone();
|
||||
|
|
Loading…
Reference in a new issue