Skip to content

Commit 0e77ebb

Browse files
committed
move cdn into context as backend, tests for purge after build
1 parent c02b5ee commit 0e77ebb

File tree

10 files changed

+409
-83
lines changed

10 files changed

+409
-83
lines changed

Cargo.lock

Lines changed: 107 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ serde_cbor = "0.11.1"
6969
getrandom = "0.2.1"
7070

7171
# Async
72-
tokio = { version = "1.0", features = ["rt-multi-thread"] }
72+
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
7373
futures-util = "0.3.5"
7474
aws-config = "0.48.0"
7575
aws-sdk-s3 = "0.18.0"
@@ -116,6 +116,8 @@ rand = "0.8"
116116
mockito = "0.31.0"
117117
test-case = "2.0.0"
118118
fn-error-context = "0.2.0"
119+
aws-smithy-client = { version = "0.48.0", features = ["test-util"]}
120+
aws-smithy-http = "0.48.0"
119121

120122
[build-dependencies]
121123
time = "0.3"
@@ -133,4 +135,4 @@ harness = false
133135
[[bin]]
134136
name = "cratesfyi"
135137
test = false
136-
doc = false
138+
oc = false

src/bin/cratesfyi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::path::PathBuf;
44
use std::sync::Arc;
55

66
use anyhow::{anyhow, Context as _, Error, Result};
7+
use docs_rs::cdn::CdnBackend;
78
use docs_rs::db::{self, add_path_into_database, Pool, PoolClient};
89
use docs_rs::repositories::RepositoryStatsUpdater;
910
use docs_rs::utils::{
@@ -559,6 +560,7 @@ enum DeleteSubcommand {
559560
struct BinContext {
560561
build_queue: OnceCell<Arc<BuildQueue>>,
561562
storage: OnceCell<Arc<Storage>>,
563+
cdn: OnceCell<Arc<CdnBackend>>,
562564
config: OnceCell<Arc<Config>>,
563565
pool: OnceCell<Pool>,
564566
metrics: OnceCell<Arc<Metrics>>,
@@ -572,6 +574,7 @@ impl BinContext {
572574
Self {
573575
build_queue: OnceCell::new(),
574576
storage: OnceCell::new(),
577+
cdn: OnceCell::new(),
575578
config: OnceCell::new(),
576579
pool: OnceCell::new(),
577580
metrics: OnceCell::new(),
@@ -611,6 +614,7 @@ impl Context for BinContext {
611614
self.config()?,
612615
self.runtime()?,
613616
)?;
617+
fn cdn(self) -> CdnBackend = CdnBackend::new(&self.config()?, &self.runtime()?);
614618
fn config(self) -> Config = Config::from_env()?;
615619
fn metrics(self) -> Metrics = Metrics::new()?;
616620
fn runtime(self) -> Runtime = Runtime::new()?;

src/cache.rs

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)