Commit e0b00bda authored by Kirill Smelkov's avatar Kirill Smelkov

bigfile/zodb: Make "set blkdata to be later saved to DB" explicit method of ZBlk

- to keep things uniform with counterpart .loadblkdata()
- so that master do not mess with ZBlk internals and works only through
  interface - this way it will be possible to use several
  kinds of ZBlk.
parent a9072290
...@@ -76,6 +76,11 @@ class ZBlk(Persistent): ...@@ -76,6 +76,11 @@ class ZBlk(Persistent):
return blkdata return blkdata
# client requests us to set blkdata to be later saved to DB
# (DB <- ) ._v_blkdata <- memory-page
def setblkdata(self, buf):
self._v_blkdata = bytes(buf) # FIXME does memcpy
# DB (through pickle) requests us to emit state to save # DB (through pickle) requests us to emit state to save
# DB <- ._v_blkdata (<- memory-page) # DB <- ._v_blkdata (<- memory-page)
...@@ -244,7 +249,7 @@ class ZBigFile(LivePersistent): ...@@ -244,7 +249,7 @@ class ZBigFile(LivePersistent):
if zblk is None: if zblk is None:
zblk = self.blktab[blk] = ZBlk() zblk = self.blktab[blk] = ZBlk()
zblk._v_blkdata = bytes(buf) # FIXME does memcpy zblk.setblkdata(buf)
zblk._p_changed = True # if zblk was already in DB: _p_state -> CHANGED zblk._p_changed = True # if zblk was already in DB: _p_state -> CHANGED
zblk.bindzfile(self, blk) zblk.bindzfile(self, blk)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment