File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
crates/matrix-sdk-indexeddb/src/event_cache_store Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License
14
14
15
+ use std:: time:: Duration ;
16
+
15
17
use matrix_sdk_base:: {
16
18
deserialized_responses:: TimelineEvent , event_cache:: store:: extract_event_relation,
17
19
linked_chunk:: ChunkIdentifier ,
18
20
} ;
19
21
use ruma:: { OwnedEventId , OwnedRoomId , RoomId } ;
20
22
use serde:: { Deserialize , Serialize } ;
21
23
24
+ /// Representation of a time-based lock on the entire
25
+ /// [`IndexeddbEventCacheStore`](crate::event_cache_store::IndexeddbEventCacheStore)
26
+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
27
+ pub struct Lease {
28
+ pub key : String ,
29
+ pub holder : String ,
30
+ pub expiration : Duration ,
31
+ }
32
+
33
+ impl Lease {
34
+ /// Determines whether the lease is expired at a given time `t`
35
+ pub fn expired_at ( & self , t : Duration ) -> bool {
36
+ self . expiration < t
37
+ }
38
+ }
39
+
22
40
/// Representation of a [`Chunk`](matrix_sdk_base::linked_chunk::Chunk)
23
41
/// which can be stored in IndexedDB.
24
42
#[ derive( Debug , Serialize , Deserialize ) ]
You can’t perform that action at this time.
0 commit comments