make TimelineCache::timelines private

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-07-15 16:14:03 -04:00
parent dc4e3d7510
commit cc92fc2082
8 changed files with 14 additions and 21 deletions

View File

@@ -281,7 +281,7 @@ impl NewNotes {
) {
let reversed = false;
let timeline = if let Some(profile) = timeline_cache.timelines.get_mut(&self.id) {
let timeline = if let Some(profile) = timeline_cache.get_mut(&self.id) {
profile
} else {
error!("NewNotes: could not get timeline for key {}", self.id);

View File

@@ -130,7 +130,7 @@ fn try_process_event(
}
}
for (_kind, timeline) in damus.timeline_cache.timelines.iter_mut() {
for (_kind, timeline) in &mut damus.timeline_cache {
let is_ready = timeline::is_timeline_ready(
app_ctx.ndb,
app_ctx.pool,
@@ -252,7 +252,7 @@ fn handle_eose(
}
SubKind::FetchingContactList(timeline_uid) => {
let timeline = if let Some(tl) = timeline_cache.timelines.get_mut(timeline_uid) {
let timeline = if let Some(tl) = timeline_cache.get_mut(timeline_uid) {
tl
} else {
error!(

View File

@@ -123,11 +123,8 @@ impl Columns {
.map(|r| match r {
IntermediaryRoute::Timeline(mut timeline) => {
let route = Route::timeline(timeline.kind.clone());
timeline.subscription.increment();
timeline_cache
.timelines
.insert(timeline.kind.clone(), timeline);
timeline_cache.insert(timeline.kind.clone(), timeline);
route
}
IntermediaryRoute::Route(route) => route,

View File

@@ -13,7 +13,7 @@ use tracing::{debug, error, info, warn};
#[derive(Default)]
pub struct TimelineCache {
pub timelines: HashMap<TimelineKind, Timeline>,
timelines: HashMap<TimelineKind, Timeline>,
}
pub enum Vitality<'a, M> {

View File

@@ -504,7 +504,7 @@ pub fn send_initial_timeline_filters(
info!("Sending initial filters to {}", relay_id);
let relay = &mut pool.relays.iter_mut().find(|r| r.url() == relay_id)?;
for (_kind, timeline) in timeline_cache.timelines.iter_mut() {
for (_kind, timeline) in timeline_cache {
send_initial_timeline_filter(since_optimize, subs, relay, timeline, accounts);
}
@@ -644,7 +644,7 @@ pub fn setup_initial_nostrdb_subs(
note_cache: &mut NoteCache,
timeline_cache: &mut TimelineCache,
) -> Result<()> {
for (_kind, timeline) in timeline_cache.timelines.iter_mut() {
for (_kind, timeline) in timeline_cache {
let txn = Transaction::new(ndb).expect("txn");
if let Err(err) = setup_timeline_nostrdb_sub(ndb, &txn, note_cache, timeline) {
error!("setup_initial_nostrdb_subs: {err}");

View File

@@ -632,9 +632,7 @@ pub fn render_add_column_routes(
.router_mut()
.route_to_replaced(Route::timeline(timeline.kind.clone()));
app.timeline_cache
.timelines
.insert(timeline.kind.clone(), timeline);
app.timeline_cache.insert(timeline.kind.clone(), timeline);
}
AddColumnResponse::Algo(algo_option) => match algo_option {
@@ -674,9 +672,7 @@ pub fn render_add_column_routes(
.router_mut()
.route_to_replaced(Route::timeline(timeline.kind.clone()));
app.timeline_cache
.timelines
.insert(timeline.kind.clone(), timeline);
app.timeline_cache.insert(timeline.kind.clone(), timeline);
} else {
// we couldn't fetch the timeline yet... let's let
// the user know ?

View File

@@ -94,7 +94,7 @@ fn timeline_ui(
*/
let scroll_id = {
let timeline = if let Some(timeline) = timeline_cache.timelines.get_mut(timeline_id) {
let timeline = if let Some(timeline) = timeline_cache.get_mut(timeline_id) {
timeline
} else {
error!("tried to render timeline in column, but timeline was missing");
@@ -154,7 +154,7 @@ fn timeline_ui(
}
let scroll_output = scroll_area.show(ui, |ui| {
let timeline = if let Some(timeline) = timeline_cache.timelines.get(timeline_id) {
let timeline = if let Some(timeline) = timeline_cache.get(timeline_id) {
timeline
} else {
error!("tried to render timeline in column, but timeline was missing");