From 6f8a812b2388414ade7d4fab724c8a8d5bd4ea66 Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 10 Feb 2025 11:28:08 -0500 Subject: [PATCH] fix mod imports for bin folder --- constellation/src/{ => bin}/main.rs | 16 ++++++---------- constellation/src/consumer/mod.rs | 2 +- constellation/src/lib.rs | 4 ++++ constellation/src/server/mod.rs | 2 +- constellation/src/storage/mem_store.rs | 8 +++++++- constellation/src/storage/mod.rs | 2 +- constellation/src/storage/rocks_store.rs | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) rename constellation/src/{ => bin}/main.rs (96%) diff --git a/constellation/src/main.rs b/constellation/src/bin/main.rs similarity index 96% rename from constellation/src/main.rs rename to constellation/src/bin/main.rs index e778b64..a9dc6dd 100644 --- a/constellation/src/main.rs +++ b/constellation/src/bin/main.rs @@ -1,7 +1,3 @@ -mod consumer; -mod server; -mod storage; - use anyhow::Result; use clap::{Parser, ValueEnum}; use metrics_exporter_prometheus::PrometheusBuilder; @@ -15,11 +11,11 @@ use std::time; use tokio::runtime; use tokio_util::sync::CancellationToken; -use consumer::consume; -use server::serve; +use constellation::consumer::consume; +use constellation::server::serve; #[cfg(feature = "rocks")] -use storage::RocksStorage; -use storage::{LinkReader, LinkStorage, MemStorage, StorageStats}; +use constellation::storage::RocksStorage; +use constellation::storage::{LinkReader, LinkStorage, MemStorage, StorageStats}; const MONITOR_INTERVAL: time::Duration = time::Duration::from_secs(2); @@ -222,8 +218,8 @@ fn install_metrics_server() -> Result<()> { #[cfg(test)] mod tests { - use crate::consumer::get_actionable; - use crate::storage::{LinkReader, LinkStorage, MemStorage}; + use constellation::consumer::get_actionable; + use constellation::storage::{LinkReader, LinkStorage, MemStorage}; #[test] fn test_create_like_integrated() { diff --git a/constellation/src/consumer/mod.rs b/constellation/src/consumer/mod.rs index fc6586b..9b0dfb7 100644 --- a/constellation/src/consumer/mod.rs +++ b/constellation/src/consumer/mod.rs @@ -2,8 +2,8 @@ mod jetstream; mod jsonl_file; use crate::storage::LinkStorage; +use crate::{ActionableEvent, RecordId}; use anyhow::Result; -use constellation::{ActionableEvent, RecordId}; use jetstream::consume_jetstream; use jsonl_file::consume_jsonl_file; use links::collect_links; diff --git a/constellation/src/lib.rs b/constellation/src/lib.rs index 5da054f..bcb4e9b 100644 --- a/constellation/src/lib.rs +++ b/constellation/src/lib.rs @@ -1,3 +1,7 @@ +pub mod consumer; +pub mod server; +pub mod storage; + use links::CollectedLink; use serde::{Deserialize, Serialize}; use std::convert::From; diff --git a/constellation/src/server/mod.rs b/constellation/src/server/mod.rs index 2c49521..e4f5fdc 100644 --- a/constellation/src/server/mod.rs +++ b/constellation/src/server/mod.rs @@ -10,7 +10,7 @@ use tokio::task::block_in_place; use tokio_util::sync::CancellationToken; use crate::storage::{LinkReader, StorageStats}; -use constellation::{CountsByCount, Did, RecordId}; +use crate::{CountsByCount, Did, RecordId}; mod acceptable; mod filters; diff --git a/constellation/src/storage/mem_store.rs b/constellation/src/storage/mem_store.rs index 4b4d052..35cc2c3 100644 --- a/constellation/src/storage/mem_store.rs +++ b/constellation/src/storage/mem_store.rs @@ -1,6 +1,6 @@ use super::{LinkReader, LinkStorage, PagedAppendingCollection, StorageStats}; +use crate::{ActionableEvent, CountsByCount, Did, RecordId}; use anyhow::Result; -use constellation::{ActionableEvent, CountsByCount, Did, RecordId}; use links::CollectedLink; use std::collections::{HashMap, HashSet}; use std::sync::{Arc, Mutex}; @@ -104,6 +104,12 @@ impl MemStorage { } } +impl Default for MemStorage { + fn default() -> Self { + Self::new() + } +} + impl LinkStorage for MemStorage { fn push(&mut self, event: &ActionableEvent, _cursor: u64) -> Result<()> { match event { diff --git a/constellation/src/storage/mod.rs b/constellation/src/storage/mod.rs index f5e3fbb..e2bd053 100644 --- a/constellation/src/storage/mod.rs +++ b/constellation/src/storage/mod.rs @@ -1,5 +1,5 @@ +use crate::{ActionableEvent, CountsByCount, Did, RecordId}; use anyhow::Result; -use constellation::{ActionableEvent, CountsByCount, Did, RecordId}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; diff --git a/constellation/src/storage/rocks_store.rs b/constellation/src/storage/rocks_store.rs index 8fa0743..5c34ea6 100644 --- a/constellation/src/storage/rocks_store.rs +++ b/constellation/src/storage/rocks_store.rs @@ -1,7 +1,7 @@ use super::{ActionableEvent, LinkReader, LinkStorage, PagedAppendingCollection, StorageStats}; +use crate::{CountsByCount, Did, RecordId}; use anyhow::{bail, Result}; use bincode::Options as BincodeOptions; -use constellation::{CountsByCount, Did, RecordId}; use links::CollectedLink; use rocksdb::{ AsColumnFamilyRef, ColumnFamilyDescriptor, DBWithThreadMode, IteratorMode, MergeOperands, -- 2.51.2