@@ -73,7 +73,6 @@ use common::{
7373 Timestamp ,
7474 WriteTimestamp ,
7575 } ,
76- value:: ResolvedDocumentId ,
7776} ;
7877use errors:: ErrorMetadata ;
7978use fastrace:: prelude:: * ;
@@ -142,7 +141,6 @@ use crate::{
142141 PendingWrites ,
143142 WriteSource ,
144143 } ,
145- writes:: DocumentWrite ,
146144 ComponentRegistry ,
147145 Snapshot ,
148146 Transaction ,
@@ -695,10 +693,10 @@ impl<RT: Runtime> Committer<RT> {
695693 // which is the same order they should be applied to database metadata
696694 // and index data structures
697695 let mut ordered_updates = updates;
698- ordered_updates. sort_by_key ( |( id , update) | {
696+ ordered_updates. sort_by_key ( |update| {
699697 table_dependency_sort_key (
700698 BootstrapTableIds :: new ( & transaction. table_mapping ) ,
701- InternalDocumentId :: from ( * * id) ,
699+ InternalDocumentId :: from ( update . id ) ,
702700 update. new_document . as_ref ( ) ,
703701 )
704702 } ) ;
@@ -717,7 +715,7 @@ impl<RT: Runtime> Committer<RT> {
717715 commit_ts,
718716 ordered_updates
719717 . into_iter ( )
720- . map ( |( & id , update) | ( id, PackedDocumentUpdate :: pack ( update) ) )
718+ . map ( |update| ( update . id , PackedDocumentUpdate :: pack ( update) ) )
721719 . collect ( ) ,
722720 write_source,
723721 snapshot,
@@ -735,7 +733,7 @@ impl<RT: Runtime> Committer<RT> {
735733 fn compute_writes (
736734 & self ,
737735 commit_ts : Timestamp ,
738- ordered_updates : & Vec < ( & ResolvedDocumentId , & DocumentUpdateWithPrevTs ) > ,
736+ ordered_updates : & Vec < & DocumentUpdateWithPrevTs > ,
739737 ) -> anyhow:: Result < (
740738 Vec < ValidatedDocumentWrite > ,
741739 BTreeSet < ( Timestamp , DatabaseIndexUpdate ) > ,
@@ -754,16 +752,14 @@ impl<RT: Runtime> Committer<RT> {
754752 . pending_writes
755753 . latest_snapshot ( )
756754 . unwrap_or_else ( || self . snapshot_manager . read ( ) . latest_snapshot ( ) ) ;
757- for & ( id , document_update) in ordered_updates. iter ( ) {
755+ for & document_update in ordered_updates. iter ( ) {
758756 let ( updates, doc_in_vector_index) =
759757 latest_pending_snapshot. update ( document_update, commit_ts) ?;
760758 index_writes. extend ( updates) ;
761759 document_writes. push ( ValidatedDocumentWrite {
762760 commit_ts,
763- id : ( * id) . into ( ) ,
764- write : DocumentWrite {
765- document : document_update. new_document . clone ( ) ,
766- } ,
761+ id : document_update. id . into ( ) ,
762+ write : document_update. new_document . clone ( ) ,
767763 doc_in_vector_index,
768764 prev_ts : document_update. old_document . as_ref ( ) . map ( |& ( _, ts) | ts) ,
769765 } ) ;
@@ -934,7 +930,7 @@ impl<RT: Runtime> Committer<RT> {
934930 . map ( |write| DocumentLogEntry {
935931 ts : write. commit_ts ,
936932 id : write. id ,
937- value : write. write . document ,
933+ value : write. write ,
938934 prev_ts : write. prev_ts ,
939935 } )
940936 . collect_vec ( ) ,
@@ -1021,7 +1017,7 @@ impl<RT: Runtime> Committer<RT> {
10211017 }
10221018 for validated_write in document_writes {
10231019 let ValidatedDocumentWrite {
1024- write : DocumentWrite { document } ,
1020+ write : document,
10251021 doc_in_vector_index,
10261022 ..
10271023 } = validated_write;
@@ -1090,7 +1086,7 @@ impl<RT: Runtime> Committer<RT> {
10901086struct ValidatedDocumentWrite {
10911087 commit_ts : Timestamp ,
10921088 id : InternalDocumentId ,
1093- write : DocumentWrite ,
1089+ write : Option < ResolvedDocument > ,
10941090 doc_in_vector_index : DocInVectorIndex ,
10951091 prev_ts : Option < Timestamp > ,
10961092}
0 commit comments