clean up the implementation of the new memfiles.resize
This commit is contained in:
parent
77a884f178
commit
f828e5da49
1 changed files with 27 additions and 27 deletions
|
|
@ -282,13 +282,13 @@ proc flush*(f: var MemFile; attempts: Natural = 3) =
|
|||
if lastErr != EBUSY.OSErrorCode:
|
||||
raiseOSError(lastErr, "error flushing mapping")
|
||||
|
||||
proc resize*(f: var MemFile, newFileSize: int) =
|
||||
## resize and re-map the file underlying an ``allowRemap MemFile``. NOTE:
|
||||
## this assumes the entire file is mapped read-write at offset zero. Also,
|
||||
## the value of ``.mem`` will probably change.
|
||||
when defined(windows):
|
||||
discard #TODO This needs to be implemented.
|
||||
else:
|
||||
when defined(posix) or defined(nimdoc):
|
||||
proc resize*(f: var MemFile, newFileSize: int) {.raises: [IOError, OSError].} =
|
||||
## resize and re-map the file underlying an ``allowRemap MemFile``.
|
||||
## **Note**: this assumes the entire file is mapped read-write at offset zero.
|
||||
## Also, the value of ``.mem`` will probably change.
|
||||
## **Note**: This is not (yet) avaiable on Windows.
|
||||
when defined(posix):
|
||||
if f.handle == -1:
|
||||
raise newException(IOError,
|
||||
"Cannot resize MemFile opened with allowRemap=false")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue