tracks lexicons and how many times they appeared on the jetstream
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(server): configure fjall to use fifo compaction

dusk 80ad1a08 7488e63a

+13 -6
+12 -6
server/src/db.rs
··· 60 60 impl Db { 61 61 pub fn new() -> AppResult<Self> { 62 62 tracing::info!("opening db..."); 63 - let inner = Keyspace::open(Config::default())?; 63 + let ks = Config::default() 64 + .cache_size(8 * 1024 * 1024) // from talna 65 + .open()?; 64 66 Ok(Self { 65 67 hits: Default::default(), 66 - counts: inner.open_partition("_counts", PartitionCreateOptions::default())?, 67 - inner, 68 + counts: ks.open_partition("_counts", PartitionCreateOptions::default())?, 69 + inner: ks, 68 70 event_broadcaster: broadcast::channel(1000).0, 69 71 }) 70 72 } ··· 80 82 f: impl FnOnce(&Partition) -> AppResult<()>, 81 83 ) -> AppResult<()> { 82 84 f(self.hits.pin().get_or_insert_with(SmolStr::new(nsid), || { 83 - self.inner 84 - .open_partition(nsid, PartitionCreateOptions::default()) 85 - .unwrap() 85 + let opts = PartitionCreateOptions::default().compaction_strategy( 86 + fjall::compaction::Strategy::Fifo(fjall::compaction::Fifo { 87 + limit: 5 * 1024 * 1024 * 1024, // 5 gb 88 + ttl_seconds: Some(60 * 60 * 24 * 30), // 30 days 89 + }), 90 + ); 91 + self.inner.open_partition(nsid, opts).unwrap() 86 92 })) 87 93 } 88 94
+1
server/src/main.rs
··· 84 84 std::thread::spawn({ 85 85 let db = db.clone(); 86 86 move || { 87 + tracing::info!("starting ingest events thread..."); 87 88 while let Some(e) = event_rx.blocking_recv() { 88 89 if let Err(e) = db.record_event(e) { 89 90 tracing::error!("failed to record event: {}", e);