Skip to content

Commit

Permalink
Re-write RRDP collector for archives.
Browse files Browse the repository at this point in the history
  • Loading branch information
partim committed Sep 11, 2023
1 parent e0acc9f commit 1605f30
Show file tree
Hide file tree
Showing 17 changed files with 3,214 additions and 2,731 deletions.
11 changes: 6 additions & 5 deletions src/collector/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

use std::collections::HashSet;
use std::path::Path;
use std::sync::Arc;
use bytes::Bytes;
use log::info;
use rpki::repository::tal::TalUri;
use rpki::uri;
use crate::config::{Config, FallbackPolicy};
use crate::error::Failed;
use crate::error::{Failed, RunFailed};
use crate::metrics::Metrics;
use crate::engine::CaCert;
use super::{rrdp, rsync};
Expand Down Expand Up @@ -178,7 +179,7 @@ impl<'a> Run<'a> {
/// `Ok(None)`.
pub fn repository<'s>(
&'s self, ca: &'s CaCert
) -> Result<Option<Repository<'s>>, Failed> {
) -> Result<Option<Repository<'s>>, RunFailed> {
// See if we should and can use RRDP
if let Some(rrdp_uri) = ca.rpki_notify() {
if let Some(ref rrdp) = self.rrdp {
Expand Down Expand Up @@ -273,7 +274,7 @@ enum RepoInner<'a> {
/// The repository is accessed via RRDP.
Rrdp {
/// The repository.
repository: rrdp::Repository,
repository: Arc<rrdp::ReadRepository>,
},

/// The repository is accessed via rsync.
Expand All @@ -285,7 +286,7 @@ enum RepoInner<'a> {

impl<'a> Repository<'a> {
/// Creates a RRDP repository.
fn rrdp(repository: rrdp::Repository) -> Self {
fn rrdp(repository: Arc<rrdp::ReadRepository>) -> Self {
Repository(RepoInner::Rrdp { repository })
}

Expand All @@ -307,7 +308,7 @@ impl<'a> Repository<'a> {
/// information and returns `None`.
pub fn load_object(
&self, uri: &uri::Rsync
) -> Result<Option<Bytes>, Failed> {
) -> Result<Option<Bytes>, RunFailed> {
match self.0 {
RepoInner::Rrdp { ref repository } => {
repository.load_object(uri)
Expand Down
1 change: 1 addition & 0 deletions src/collector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ mod base;
mod rrdp;
mod rsync;

pub mod newrrdp;
Empty file added src/collector/newrrdp.rs
Empty file.
Loading

0 comments on commit 1605f30

Please sign in to comment.