Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
refactor: rename NodeEventSource to BrokerEventSource
Lars Wirzenius committed 1 year ago
commit 72c6a3396fc37212dc5487c670fa67fa2d53a739
parent c7b0b393679bfa249f22013232b0549b1deb36d3
3 files changed +6 -6
modified src/bin/cibtoolcmd/event.rs
@@ -1,6 +1,6 @@
use std::io::Write;

-
use radicle_ci_broker::event::{EventFilter, NodeEventSource};
+
use radicle_ci_broker::event::{BrokerEventSource, EventFilter};

use super::*;

@@ -312,7 +312,7 @@ pub struct RecordEvents {
impl Leaf for RecordEvents {
    fn run(&self, _args: &Args) -> Result<(), CibToolError> {
        let profile = util::load_profile()?;
-
        let mut source = NodeEventSource::new(&profile).map_err(CibToolError::EventSubscribe)?;
+
        let mut source = BrokerEventSource::new(&profile).map_err(CibToolError::EventSubscribe)?;
        let mut file = if let Some(filename) = &self.output {
            Some(
                std::fs::File::create(filename)
modified src/event.rs
@@ -49,12 +49,12 @@ use crate::logger;
/// The events are filtered. Only events allowed by at least one
/// filter are returned. See [`NodeEventSource::allow`] and
/// [`EventFilter`].
-
pub struct NodeEventSource {
+
pub struct BrokerEventSource {
    events: Box<dyn Iterator<Item = Result<Event, radicle::node::Error>>>,
    allowed: Vec<EventFilter>,
}

-
impl NodeEventSource {
+
impl BrokerEventSource {
    /// Create a new source of node events, for a given Radicle
    /// profile.
    pub fn new(profile: &Profile) -> Result<Self, NodeEventError> {
modified src/queueadd.rs
@@ -4,7 +4,7 @@ use radicle::Profile;

use crate::{
    db::{Db, DbError},
-
    event::{BrokerEvent, EventFilter, NodeEventError, NodeEventSource},
+
    event::{BrokerEvent, BrokerEventSource, EventFilter, NodeEventError},
    logger,
    notif::NotificationSender,
};
@@ -65,7 +65,7 @@ impl QueueAdder {

        let profile = Profile::load()?;

-
        let mut source = NodeEventSource::new(&profile)?;
+
        let mut source = BrokerEventSource::new(&profile)?;

        for filter in self.filters.iter() {
            source.allow(filter.clone());