Skip to content

Commit

Permalink
Revert "drop CBOR index support & migration"
Browse files Browse the repository at this point in the history
This reverts commit ea7eb5c.
  • Loading branch information
Nemo157 authored and syphar committed Aug 9, 2023
1 parent a4e1030 commit 1912cad
Show file tree
Hide file tree
Showing 7 changed files with 462 additions and 52 deletions.
3 changes: 3 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ignore = [
"RUSTSEC-2020-0036", # failure is officially deprecated/unmaintained
# https://github.com/rust-lang/docs.rs/issues/1014

"RUSTSEC-2021-0127", # serde_cbor is unmaintained
# https://github.com/rust-lang/docs.rs/issues/1568

"RUSTSEC-2023-0018", # rustwide -> remove_dir_all,TOCTOU / Race Condition
# https://github.com/rust-lang/docs.rs/issues/2074
]
Expand Down
37 changes: 29 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ string_cache = "0.8.0"
postgres-types = { version = "0.2", features = ["derive"] }
zip = {version = "0.6.2", default-features = false, features = ["bzip2"]}
bzip2 = "0.4.4"
serde_cbor = "0.11.1"
getrandom = "0.2.1"
itertools = { version = "0.11.0", optional = true}
rusqlite = { version = "0.29.0", features = ["bundled"] }
Expand All @@ -86,6 +87,7 @@ uuid = "1.1.2"
# Data serialization and deserialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
memmap2 = "0.5.0"

# axum dependencies
axum = { version = "0.6.1", features = ["headers"]}
Expand Down
11 changes: 9 additions & 2 deletions src/bin/cratesfyi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use docs_rs::utils::{
remove_crate_priority, set_crate_priority, ConfigName,
};
use docs_rs::{
start_background_metrics_webserver, start_web_server, BuildQueue, Config, Context, Index,
InstanceMetrics, PackageKind, RustwideBuilder, ServiceMetrics, Storage,
migrate_old_archive_indexes, start_background_metrics_webserver, start_web_server, BuildQueue,
Config, Context, Index, InstanceMetrics, PackageKind, RustwideBuilder, ServiceMetrics, Storage,
};
use humantime::Duration;
use once_cell::sync::OnceCell;
Expand Down Expand Up @@ -482,6 +482,9 @@ enum DatabaseSubcommand {
/// Backfill GitHub/Gitlab stats for crates.
BackfillRepositoryStats,

/// migrate the old CBOR archive index files to SQLIte
MigrateArchiveIndex,

/// Updates info for a crate from the registry's API
UpdateCrateRegistryFields {
#[arg(name = "CRATE")]
Expand Down Expand Up @@ -533,6 +536,10 @@ impl DatabaseSubcommand {
ctx.repository_stats_updater()?.update_all_crates()?;
}

Self::MigrateArchiveIndex => {
migrate_old_archive_indexes(&*ctx.storage()?, &mut *ctx.conn()?)?;
}

Self::BackfillRepositoryStats => {
ctx.repository_stats_updater()?.backfill_repositories()?;
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub use self::docbuilder::PackageKind;
pub use self::docbuilder::RustwideBuilder;
pub use self::index::Index;
pub use self::metrics::{InstanceMetrics, ServiceMetrics};
pub use self::storage::migrate_old_archive_indexes;
pub use self::storage::Storage;
pub use self::web::{start_background_metrics_webserver, start_web_server};

Expand Down
Loading

0 comments on commit 1912cad

Please sign in to comment.