@@ -63,6 +63,13 @@ def obj_exists(self, key: ObjectStorageProvider_KeyType) -> bool:
63
63
Check whether a given object exists in storage.
64
64
"""
65
65
66
+ @abstractmethod
67
+ def mtime (self , key : ObjectStorageProvider_KeyType ) -> float :
68
+ """
69
+ Return the last modified time in seconds since the epoc for the object.
70
+ If the object does not exist, an exception should be raised.
71
+ """
72
+
66
73
@abstractmethod
67
74
def obj_rename (self , src : ObjectStorageProvider_KeyType , dst : ObjectStorageProvider_KeyType ) -> None :
68
75
"""
@@ -181,6 +188,10 @@ def obj_exists(self, key: ObjectStorageProvider_KeyType) -> bool:
181
188
obj_filepath = self ._obj_filepath (key )
182
189
return obj_filepath .exists ()
183
190
191
+ def mtime (self , key : ObjectStorageProvider_KeyType ) -> float :
192
+ obj_filepath = self ._obj_filepath (key )
193
+ return obj_filepath .stat ().st_mtime
194
+
184
195
def obj_rename (self , src : ObjectStorageProvider_KeyType , dst : ObjectStorageProvider_KeyType ) -> None :
185
196
src_filepath = self ._obj_filepath (src )
186
197
dst_filepath = self ._obj_filepath (dst )
@@ -493,7 +504,7 @@ def lazy_reload(self):
493
504
# Have data. No path. Continue with in memory value.
494
505
return
495
506
496
- if int ( self ._file_path . stat (). st_mtime ) > self ._load_time :
507
+ if self ._object_storage_provider . mtime ( self . _file_path ) > self ._load_time :
497
508
self .load ()
498
509
499
510
def lazy_get (self , field ):
0 commit comments