Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Add some lifetimes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellie Huxtable committed Sep 14, 2023
1 parent 3550b42 commit 726e535
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ pub fn extract_and_verify_token(events: &[RawEvent]) -> Result<String, String> {
};
}

pub async fn process_events(
pub async fn process_events<'a>(
sink: Arc<dyn sink::EventSink + Send + Sync>,
events: &[RawEvent],
context: &ProcessingContext,
events: &'a [RawEvent],
context: &'a ProcessingContext,
) -> Result<(), String> {
let events: Vec<ProcessedEvent> = match events
.iter()
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub mod sink;
pub mod time;

mod capture;
mod token;
mod utils;
mod prometheus;
mod token;
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,22 @@ mod sink;
mod time;
mod token;
mod utils;

use crate::time::SystemTime;
use crate::{router, sink};
mod prometheus;

#[tokio::main]
async fn main() {
let use_print_sink = env::var("PRINT_SINK").is_ok();
let address = env::var("ADDRESS").unwrap_or(String::from("127.0.0.1:3000"));

let app = if use_print_sink {
router::router(SystemTime {}, sink::PrintSink {}, true)
router::router(time::SystemTime {}, sink::PrintSink {}, true)
} else {
let brokers = env::var("KAFKA_BROKERS").expect("Expected KAFKA_BROKERS");
let topic = env::var("KAFKA_TOPIC").expect("Expected KAFKA_TOPIC");

let sink = sink::KafkaSink::new(topic, brokers).unwrap();

router::router(SystemTime {}, sink, true)
router::router(time::SystemTime {}, sink, true)
};

// initialize tracing
Expand Down

0 comments on commit 726e535

Please sign in to comment.