@@ -812,6 +812,15 @@ mod private {
812812 } )
813813 }
814814
815+ /// Lock this [`RoomEventCacheStateLock`] with per-thread shared access.
816+ ///
817+ /// This method locks the per-thread lock over the state, and then locks
818+ /// the cross-process lock over the store. It returns an RAII guard
819+ /// which will drop the read access to the state and to the store when
820+ /// dropped.
821+ ///
822+ /// If the cross-process lock over the store is dirty (see
823+ /// [`EventCacheStoreLockState`]), the state is reset to the last chunk.
815824 pub async fn read ( & self ) -> Result < RoomEventCacheStateLockReadGuard < ' _ > , EventCacheError > {
816825 // Take a write-lock in case the lock is dirty and we need to reset the state.
817826 let state_guard = self . locked_state . write ( ) . await ;
@@ -843,6 +852,16 @@ mod private {
843852 }
844853 }
845854
855+ /// Lock this [`RoomEventCacheStateLock`] with exclusive per-thread
856+ /// write access.
857+ ///
858+ /// This method locks the per-thread lock over the state, and then locks
859+ /// the cross-process lock over the store. It returns an RAII guard
860+ /// which will drop the write access to the state and to the store when
861+ /// dropped.
862+ ///
863+ /// If the cross-process lock over the store is dirty (see
864+ /// [`EventCacheStoreLockState`]), the state is reset to the last chunk.
846865 pub async fn write (
847866 & self ,
848867 ) -> Result < RoomEventCacheStateLockWriteGuard < ' _ > , EventCacheError > {
@@ -868,13 +887,23 @@ mod private {
868887 }
869888 }
870889
890+ /// The read lock guard returned by [`RoomEventCacheStateLock::read`].
871891 pub struct RoomEventCacheStateLockReadGuard < ' a > {
892+ /// The per-thread read lock guard over the
893+ /// [`RoomEventCacheStateLockInner`].
872894 state : RwLockReadGuard < ' a , RoomEventCacheStateLockInner > ,
895+
896+ /// The cross-process lock guard over the store.
873897 store : EventCacheStoreLockGuard ,
874898 }
875899
900+ /// The write lock guard return by [`RoomEventCacheStateLock::write`].
876901 pub struct RoomEventCacheStateLockWriteGuard < ' a > {
902+ /// The per-thread write lock guard over the
903+ /// [`RoomEventCacheStateLockInner`].
877904 state : RwLockWriteGuard < ' a , RoomEventCacheStateLockInner > ,
905+
906+ /// The cross-process lock guard over the store.
878907 store : EventCacheStoreLockGuard ,
879908 }
880909
0 commit comments