java.lang.Object
me.ahoo.cosid.internal.WindowFile
The window file of a
StaticSlot (05-machine-lease.md ยง4.4): one ceiling, written to a temporary file,
fsynced, then moved over the old file atomically, so a crash leaves either the old or the new ceiling, never a torn
one.-
Constructor Details
-
WindowFile
A window file.- Parameters:
path- the file
-
-
Method Details
-
path
-
read
Reads the persisted ceiling.- Returns:
- the ceiling in milliseconds, or empty if the file does not exist
- Throws:
CosIdException- if the file is not a window file: refusing beats guessing a floorUncheckedIOException- if the file cannot be read
-
write
public void write(long ceiling) Persistsceilingdurably: when this returns, a crash cannot lose it.- Parameters:
ceiling- the ceiling in milliseconds- Throws:
UncheckedIOException- if the file cannot be written
-