Selfie
Loading...
Searching...
No Matches
selfie_lib.WriteTracker.ToBeFileLazyBytes Class Reference
Inheritance diagram for selfie_lib.WriteTracker.ToBeFileLazyBytes:
selfie_lib.WriteTracker.ToBeFileWriteTracker

Public Member Functions

 __init__ (self, TypedPath location, SnapshotFileLayout layout, bytes data)
 
None writeToDisk (self)
 
 readData (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 

Public Attributes

 location
 
 layout
 
 data
 

Detailed Description

Definition at line 250 of file WriteTracker.py.

Constructor & Destructor Documentation

◆ __init__()

selfie_lib.WriteTracker.ToBeFileLazyBytes.__init__ (   self,
TypedPath  location,
SnapshotFileLayout  layout,
bytes  data 
)

Reimplemented in selfie_lib.WriteTracker.ToBeFileWriteTracker.

Definition at line 251 of file WriteTracker.py.

251 def __init__(self, location: TypedPath, layout: SnapshotFileLayout, data: bytes):
252 self.location = location
253 self.layout = layout
254 self.data = data
255

Member Function Documentation

◆ __eq__()

selfie_lib.WriteTracker.ToBeFileLazyBytes.__eq__ (   self,
  other 
)

Definition at line 267 of file WriteTracker.py.

267 def __eq__(self, other):
268 if not isinstance(other, ToBeFileLazyBytes):
269 return False
270 return self.readData() == other.readData()
271

◆ __hash__()

selfie_lib.WriteTracker.ToBeFileLazyBytes.__hash__ (   self)

Definition at line 272 of file WriteTracker.py.

272 def __hash__(self):
273 return hash(self.readData())
274
275

◆ readData()

selfie_lib.WriteTracker.ToBeFileLazyBytes.readData (   self)

Definition at line 262 of file WriteTracker.py.

262 def readData(self):
263 if self.data is not None:
264 return self.data
265 return self.layout.fs.file_read_binary(self.location)
266

◆ writeToDisk()

None selfie_lib.WriteTracker.ToBeFileLazyBytes.writeToDisk (   self)

Reimplemented in selfie_lib.WriteTracker.ToBeFileWriteTracker.

Definition at line 256 of file WriteTracker.py.

256 def writeToDisk(self) -> None:
257 if self.data is None:
258 raise Exception("Data has already been written to disk")
259 self.layout.fs.file_write_binary(self.location, self.data)
260 self.data = None # Allow garbage collection
261

Member Data Documentation

◆ data

selfie_lib.WriteTracker.ToBeFileLazyBytes.data

Definition at line 254 of file WriteTracker.py.

◆ layout

selfie_lib.WriteTracker.ToBeFileLazyBytes.layout

Definition at line 253 of file WriteTracker.py.

◆ location

selfie_lib.WriteTracker.ToBeFileLazyBytes.location

Definition at line 252 of file WriteTracker.py.


The documentation for this class was generated from the following file: