|
23 | 23 | use async_trait::async_trait; |
24 | 24 | use cano::error::CanoError; |
25 | 25 | use cano::prelude::*; |
26 | | -use cano::store::{MemoryStore, StoreTrait}; |
| 26 | +use cano::store::{MemoryStore, Store}; |
27 | 27 | use futures::future::join_all; |
28 | 28 | use std::collections::{HashMap, HashSet}; |
29 | 29 | use tokio::time::{Duration, timeout}; |
@@ -275,7 +275,7 @@ impl Node<BookPrepositionAction> for BookDownloaderNode { |
275 | 275 | } |
276 | 276 |
|
277 | 277 | /// Preparation: Get the list of books to download |
278 | | - async fn prep(&self, _store: &MemoryStore) -> Result<Self::PrepResult, CanoError> { |
| 278 | + async fn prep(&self, _store: &impl Store) -> Result<Self::PrepResult, CanoError> { |
279 | 279 | let book_list = Self::get_book_list(); |
280 | 280 | println!("📋 Prepared {} books for download", book_list.len()); |
281 | 281 | Ok(book_list) |
@@ -322,7 +322,7 @@ impl Node<BookPrepositionAction> for BookDownloaderNode { |
322 | 322 | /// Post-processing: Store downloaded books in memory |
323 | 323 | async fn post( |
324 | 324 | &self, |
325 | | - store: &MemoryStore, |
| 325 | + store: &impl Store, |
326 | 326 | exec_res: Self::ExecResult, |
327 | 327 | ) -> Result<BookPrepositionAction, CanoError> { |
328 | 328 | if exec_res.is_empty() { |
@@ -415,7 +415,7 @@ impl Node<BookPrepositionAction> for PrepositionNode { |
415 | 415 | } |
416 | 416 |
|
417 | 417 | /// Preparation: Load downloaded books from memory |
418 | | - async fn prep(&self, store: &MemoryStore) -> Result<Self::PrepResult, CanoError> { |
| 418 | + async fn prep(&self, store: &impl Store) -> Result<Self::PrepResult, CanoError> { |
419 | 419 | let books: Vec<Book> = store |
420 | 420 | .get("downloaded_books") |
421 | 421 | .map_err(|e| CanoError::preparation(format!("Failed to load books: {e}")))?; |
@@ -454,7 +454,7 @@ impl Node<BookPrepositionAction> for PrepositionNode { |
454 | 454 | /// Post-processing: Store analysis results |
455 | 455 | async fn post( |
456 | 456 | &self, |
457 | | - store: &MemoryStore, |
| 457 | + store: &impl Store, |
458 | 458 | exec_res: Self::ExecResult, |
459 | 459 | ) -> Result<BookPrepositionAction, CanoError> { |
460 | 460 | if exec_res.is_empty() { |
@@ -501,7 +501,7 @@ impl Node<BookPrepositionAction> for BookRankingByPrepositionNode { |
501 | 501 | } |
502 | 502 |
|
503 | 503 | /// Preparation: Load book analyses from memory |
504 | | - async fn prep(&self, store: &MemoryStore) -> Result<Self::PrepResult, CanoError> { |
| 504 | + async fn prep(&self, store: &impl Store) -> Result<Self::PrepResult, CanoError> { |
505 | 505 | let analyses: Vec<BookAnalysis> = store |
506 | 506 | .get("book_analyses") |
507 | 507 | .map_err(|e| CanoError::preparation(format!("Failed to load analyses: {e}")))?; |
@@ -545,7 +545,7 @@ impl Node<BookPrepositionAction> for BookRankingByPrepositionNode { |
545 | 545 | /// Post-processing: Store final rankings and display results |
546 | 546 | async fn post( |
547 | 547 | &self, |
548 | | - store: &MemoryStore, |
| 548 | + store: &impl Store, |
549 | 549 | exec_res: Self::ExecResult, |
550 | 550 | ) -> Result<BookPrepositionAction, CanoError> { |
551 | 551 | store.put("book_rankings", exec_res.clone())?; |
@@ -711,7 +711,7 @@ async fn main() { |
711 | 711 | #[cfg(test)] |
712 | 712 | mod tests { |
713 | 713 | use super::*; |
714 | | - use cano::store::{MemoryStore, StoreTrait}; |
| 714 | + use cano::store::{MemoryStore, Store}; |
715 | 715 |
|
716 | 716 | #[tokio::test] |
717 | 717 | async fn test_book_downloader_prep() { |
|
0 commit comments