@@ -557,7 +557,7 @@ pub(crate) struct DocumentInfo {
557557 change_observers : Vec < RepoFutureResolver < Result < ( ) , RepoError > > > ,
558558 /// Counter of local saves since last compact,
559559 /// used to make decisions about full or incemental saves.
560- saves_since_last_compact : usize ,
560+ patches_since_last_compact : usize ,
561561 ///
562562 allowable_changes_until_compaction : usize ,
563563 /// Last heads obtained from the automerge doc.
@@ -580,7 +580,7 @@ impl DocumentInfo {
580580 handle_count,
581581 sync_states : Default :: default ( ) ,
582582 change_observers : Default :: default ( ) ,
583- saves_since_last_compact : 0 ,
583+ patches_since_last_compact : 0 ,
584584 allowable_changes_until_compaction : 10 ,
585585 last_heads,
586586 }
@@ -600,7 +600,7 @@ impl DocumentInfo {
600600 | DocState :: Error
601601 | DocState :: LoadPending { .. }
602602 | DocState :: Bootstrap { .. } => {
603- assert_eq ! ( self . saves_since_last_compact , 0 ) ;
603+ assert_eq ! ( self . patches_since_last_compact , 0 ) ;
604604 DocState :: PendingRemoval ( vec ! [ ] )
605605 }
606606 DocState :: Sync ( ref mut storage_fut) => DocState :: PendingRemoval ( mem:: take ( storage_fut) ) ,
@@ -704,14 +704,18 @@ impl DocumentInfo {
704704 let count = {
705705 let doc = self . document . read ( ) ;
706706 let changes = doc. automerge . get_changes ( & self . last_heads ) ;
707- println ! ( "last: {:?}, current: {:?}" , self . last_heads, doc. automerge. get_heads( ) ) ;
707+ println ! (
708+ "last: {:?}, current: {:?}" ,
709+ self . last_heads,
710+ doc. automerge. get_heads( )
711+ ) ;
708712 //self.last_heads = doc.automerge.get_heads();
709713 changes. len ( )
710714 } ;
711715 let has_patches = count > 0 ;
712716 println ! ( "Has patches: {:?}" , has_patches) ;
713- self . saves_since_last_compact = self
714- . saves_since_last_compact
717+ self . patches_since_last_compact = self
718+ . patches_since_last_compact
715719 . checked_add ( count)
716720 . unwrap_or ( 0 ) ;
717721 has_patches
@@ -735,14 +739,14 @@ impl DocumentInfo {
735739 return ;
736740 }
737741 let should_compact =
738- self . saves_since_last_compact > self . allowable_changes_until_compaction ;
742+ self . patches_since_last_compact > self . allowable_changes_until_compaction ;
739743 let ( storage_fut, new_heads) = if should_compact {
740744 println ! ( "We decided to Compact the document" ) ;
741745 let ( to_save, new_heads) = {
742746 let doc = self . document . read ( ) ;
743747 ( doc. automerge . save ( ) , doc. automerge . get_heads ( ) )
744748 } ;
745- self . saves_since_last_compact = 0 ;
749+ self . patches_since_last_compact = 0 ;
746750 println ! ( "Since compact is zero" ) ;
747751 ( storage. compact ( document_id. clone ( ) , to_save) , new_heads)
748752 } else {
@@ -754,8 +758,11 @@ impl DocumentInfo {
754758 doc. automerge . get_heads ( ) ,
755759 )
756760 } ;
757- self . saves_since_last_compact . checked_add ( 1 ) . unwrap_or ( 0 ) ;
758- println ! ( "Saves since last compact {}" , self . saves_since_last_compact) ;
761+ self . patches_since_last_compact . checked_add ( 1 ) . unwrap_or ( 0 ) ;
762+ println ! (
763+ "Saves since last compact {}" ,
764+ self . patches_since_last_compact
765+ ) ;
759766 ( storage. append ( document_id. clone ( ) , to_save) , new_heads)
760767 } ;
761768 match self . state {
0 commit comments