| 810 | return self._data.loc[start_time:end_time].copy() |
| 811 | |
| 812 | def sync_to_disk(self): |
| 813 | if self._data is None: |
| 814 | raise ValueError("No data to sync to disk.") |
| 815 | self._data.sort_index(inplace=True) |
| 816 | self._data.to_hdf(self.index_path, key=self.KEY, mode="w", format="table") |
| 817 | # The index should be readable for all users |
| 818 | self.index_path.chmod(stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH) |
| 819 | |
| 820 | def sync_from_disk(self): |
| 821 | # The file will not be closed directly if we read_hdf from the disk directly |