@@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};
22
33use ids:: { IdsFollowersRecord , IdsUnfollowedRecord } ;
44use itertools:: Itertools as _;
5- use rand:: { Rng as _, thread_rng } ;
5+ use rand:: Rng as _;
66use redb:: StorageError ;
77use redb_bincode:: { ReadableTable , Table } ;
88use rostra_core:: event:: {
@@ -94,7 +94,7 @@ impl Database {
9494 . map ( |g| g. value ( ) )
9595 {
9696 Some ( prev_missing) => {
97- // if the missing was marked as deleted, we'll record it
97+ // If the missing was marked as deleted, we'll record it.
9898 (
9999 true ,
100100 if let Some ( deleted_by) = prev_missing. deleted_by {
@@ -107,7 +107,7 @@ impl Database {
107107 )
108108 }
109109 _ => {
110- // since nothing was expecting this event yet, it must be a "head"
110+ // Since nothing was expecting this event yet, it must be a "head".
111111 events_heads_table. insert ( & ( author, event_id) , & EventsHeadsTableRecord ) ?;
112112 ( false , false )
113113 }
@@ -153,18 +153,18 @@ impl Database {
153153 } ) ;
154154 }
155155 } else {
156- // we do not have this parent yet, so we mark it as missing
156+ // We do not have this parent yet, so we mark it as missing
157157 events_missing_table. insert (
158158 & ( author, parent_id) ,
159159 & EventsMissingRecord {
160- // potentially mark that the missing event was already deleted
160+ // Potentially mark that the missing event was already deleted.
161161 deleted_by : ( event. is_delete_parent_aux_content_set ( ) && parent_is_aux)
162162 . then_some ( event_id) ,
163163 } ,
164164 ) ?;
165165 missing_parents. push ( parent_id) ;
166166 }
167- // if the event was considered a "head", it shouldn't as it has a child
167+ // If the event was considered a "head", it shouldn't as it has a child.
168168 events_heads_table. remove ( & ( author, parent_id) ) ?;
169169 }
170170
@@ -225,7 +225,7 @@ impl Database {
225225 return Ok ( true ) ;
226226 }
227227 EventContentState :: Invalid ( _) | EventContentState :: Present ( _) => {
228- // go ahead and mark as pruned
228+ // Go ahead and mark as pruned
229229 }
230230 }
231231 }
@@ -396,7 +396,7 @@ impl Database {
396396 ) -> DbResult < IdSelfAccountRecord > {
397397 let id_self_record = IdSelfAccountRecord {
398398 rostra_id : self_id,
399- iroh_secret : thread_rng ( ) . r#gen ( ) ,
399+ iroh_secret : rand :: rng ( ) . random ( ) ,
400400 } ;
401401 let _ = id_self_table. insert ( & ( ) , & id_self_record) ?;
402402 Ok ( id_self_record)
@@ -438,7 +438,7 @@ impl Database {
438438 let before_pivot = ( ShortEventId :: ZERO ) ..( pivot) ;
439439 let after_pivot = ( pivot) ..=( ShortEventId :: MAX ) ;
440440
441- Ok ( Some ( if thread_rng ( ) . r#gen ( ) {
441+ Ok ( Some ( if rand :: rng ( ) . random ( ) {
442442 match get_first_in_range ( events_self_table, after_pivot) ? {
443443 Some ( k) => k,
444444 _ => match get_last_in_range ( events_self_table, before_pivot) ? {
0 commit comments